开发者

How to manage the height of UITextField when keyboard appears on the click?

I am having dynamic cells and the height of each cell is 450, in the that there is a UITextField So problem is that if I clicked on the textfield when it's on the height of view 350 the keyboar开发者_JAVA百科d hide the textfield and when scroll little above the cell and clicked than its not hidden..

I have set the height on textfield begin and endEditing but not worked all the time while scrolling...because I don't know the exact position of UITextField.

So how to set the UItextField height dynamic when the tableview scrolls?


You should not change the text field's height. You can scroll the tableview upwards to make the text field visible when the key board is up. Use setContentOffset method to scroll the table view.

CGPoint offset = [textField convertPoint:CGPointMake(0, 0) toView:tableView];
[tableview setContentOffset:CGPointMake(0, offset)];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜