Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active scroll before to active a textfield #92

Open
llKoull opened this issue Apr 8, 2014 · 9 comments
Open

Active scroll before to active a textfield #92

llKoull opened this issue Apr 8, 2014 · 9 comments

Comments

@llKoull
Copy link

llKoull commented Apr 8, 2014

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!

@iferrera
Copy link

iferrera commented Apr 8, 2014

same here 👍

@mmackowiak
Copy link

+1

@mrtristan
Copy link
Contributor

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;
}

@icodebuster
Copy link

@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.

@llKoull
Copy link
Author

llKoull commented Apr 29, 2014

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.

@icodebuster
Copy link

@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.

@orenk86
Copy link

orenk86 commented Jul 7, 2014

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?

@icodebuster
Copy link

@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.

@orenk86
Copy link

orenk86 commented Jul 10, 2014

@icodebuster
Turns out that was exactly the problem. It works like a charm now! Thanks a million!! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants