TPKeyboardAvoiding
TPKeyboardAvoiding copied to clipboard
Active scroll before to active a textfield
Hi!
I've made a form with many fields using TPKeyboardAvoidingScrollView and when I touch any of the Textfields, the scrollview works fantastic. But the problem is that I need to use the Scroll View before to activate a Textfield and I can't do this 😟
I also tried to do something like [nameTextField becomeFirstResponder]; in viewdidload, viewdidapper and viewwillappear but nothing happens. The keyboards comes up but the scroll view doesn't work, It only works if I touch the field.
Thanks!
same here :+1:
+1
this works for me but seems to randomly cause a crash on the if
here when i call becomeFirstResponder
on one of my two textviews
- (UIView*)TPKeyboardAvoiding_findFirstResponderBeneathView:(UIView*)view {
// Search recursively for first responder
for ( UIView *childView in view.subviews ) {
if ( [childView respondsToSelector:@selector(isFirstResponder)] && [childView isFirstResponder] ) return childView;
UIView *result = [self TPKeyboardAvoiding_findFirstResponderBeneathView:childView];
if ( result ) return result;
}
return nil;
}
@llKoull Did you find a working solution for this? I am also facing the same issue, the scrollview is initially not moving and starts to move only after I touch any of the textfields
Any help appreciated.
Nope, sry Jobi but i didn’t find any solutions yet 😟 I just changed the design of my view to fit all the things on It.
Regards,
RAÚL VIDAL MUIÑOS, CEO/Founder Devinet T: (+34) 931 801 823 M: (+34) 675 575 782 F: (+34) 932 843 075
El 29/04/2014, a las 19:46, Jobin Kurian [email protected] escribió:
@llKoull Did you find a working solution for this? I am also facing the same issue, the scrollview is initially not moving and starts to move only after I touch any of the textfields
Any help appreciated.
— Reply to this email directly or view it on GitHub.
@llKoull The working solution I could do was to give IBOutlet to the scrollvew and set its content size
[_scrollView setContentSize:CGSizeMake(320, 500)];
This made the scrollview scrollable and was working as required.
Hey @icodebuster , I'm having the same issue as well, and I also tried your solution, but sadly it doesn't work for me. Did you (or anyone here) manage to find a better solution by any chance?
@orenk86 If you are using storyboard with AutoLayout and UIScrollview, you no longer set the contentSize explicitly. The AutoLayout System calculates the contentSize based on your constraints. So give correct constraints to your text fields and it should work. I had the issue fixed with correct constraints to the UI Components on my scrollview.
Hope this helps.
@icodebuster Turns out that was exactly the problem. It works like a charm now! Thanks a million!! :)