我想在 UITableview
的末尾添加一个加载更多按钮。它与 Instagram 中的加载更多按钮具有相同的功能。这是照片。
所以我的问题是如何把它添加到UITableview
的末尾?由于 tableview 是可滚动的,我不知道如何给按钮一个动态位置。
提前致谢。
最佳答案
创建一个空的 UIView:UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 70)];
创建您的按钮:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Load More" forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonLoadMoreTouched) forControlEvents:UIControlEventTouchUpInside];
[button sizeToFit];
将按钮添加为 1 中 View 的 subview 。
[v addSubview:button];
将表格的 tableFooterView
属性设置为 1 中的 View 。
self.myTableView.tableFooterView = v;
关于iphone - 如何在tableview底部添加加载更多按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11175634/