且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

显示键盘时将UITextField滚动到视图中

更新时间:2021-12-23 00:31:08

您只需要将偏移量设置为键盘的高度:

You simply need to set the offset to the height of the keyboard:

CGFloat offset = kbSize.height;
CGPoint scrollPoint = CGPointMake(0.0, offset);
[self.view setContentOffset:scrollPoint animated:YES];

希望这会有所帮助