Table View scroll when text field begin editing iphone

前端 未结 3 1472
-上瘾入骨i
-上瘾入骨i 2021-01-17 04:51

I have table view controller in iphone application. Table view has two sections. First section has two rows and second section has one row. Second section has a custom table

3条回答
  •  迷失自我
    2021-01-17 05:34

    My problem was I was adding the table cell containing the UITextField in the

    - (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    

    function. If you do this the automatic UITableView scrolling doesn't work.

    So, you have to do some arithmetic to work out when your last row is showing and put your special UITableViewCell in here along with all the others.

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    

提交回复
热议问题