首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >uitableview页脚

uitableview页脚
EN

Stack Overflow用户
提问于 2012-11-26 14:59:02
回答 1查看 766关注 0票数 2

我已经在UITableView中添加了一个页脚,如果用户单击最后一个单元格的文本字段,表视图不会滚动

代码语言:javascript
复制
    -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:   (NSInteger)section{


            UIView *view =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
            [view setBackgroundColor:[UIColor blackColor]];
            return view;
}

如果是分段式工作台,请帮助

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-26 15:08:36

代码语言:javascript
复制
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    if(textField == yourTextField){ /// here write name of your Textfield in which you want to scroll tableview
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:0.3];
        yourTableView.frame = CGRectMake(yourTableView.frame.origin.x, -160, yourTableView.frame.size.width, tblContactUS.frame.size.height);
        [UIView commitAnimations];
     }
     return YES;
}

然后把你的TableView和前一帧放在一起,然后使用下面的方法

代码语言:javascript
复制
- (BOOL)textFieldShouldReturn:(UITextField *)textField 
{
    [textField resignFirstResponder];
    if(textField == yourTextField){ /// here write name of your Textfield in which you want to scroll down tableview
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:0.3];
            yourTableView.frame = CGRectMake(yourTableView.frame.origin.x, 0, yourTableView.frame.size.width, tblContactUS.frame.size.height);
            [UIView commitAnimations];
     }
    return YES;
}

我希望这能帮到你。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13560059

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档