Move up keyboard when editing UITextField on iOS9

后端 未结 7 1374
太阳男子
太阳男子 2021-02-02 00:03

For my keyboards to move up to uncover UITextField in my iOS app, I used to implement this answer: https://stackoverflow.com/a/6908258/3855618 on iOS7 and 8 and it

相关标签:
7条回答
  • 2021-02-02 00:31

    i followed the doc from @Istvan to the apple site, and there are a lot of stuff missing to make it work:
    1. Set your .h document to <UITextFieldDelegate> (to be able to work with "activefield")
    2. In the viewDidLoad, set the delegates to your UITextfields, and set the height of your scrollview content with a bigger height (in my case i've setted 500 more):

    CGRect screenRect = [[UIScreen mainScreen] bounds];
    CGFloat screenWidth = screenRect.size.width;
    CGFloat screenHeight = screenRect.size.height + 500;
    _scrollView.contentSize = CGSizeMake(screenWidth, screenHeight);
    

    And now it's all working...

    0 讨论(0)
提交回复
热议问题