嗨我想在一个uitableviewcontroller的页脚中添加一个多个图标脚,它只包含整个单个部分。
我们如何添加这个?
答案 0 :(得分:1)
实施- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
。
让它返回一个视图,您在其中添加了图标。
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0, tableView.frame.size.width,tableView.frame.height)];
UIImage *img = [UIImage imageNamed:@"nameofimage.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:img forState:UIControlStateNormal];
[button addTarget:self
action:@selector(someSelector:)
forControlEvents:UIControlEventTouchUpInside]
[view addSubView: button];
return [view autorelease]
}
答案 1 :(得分:0)
要在tableview中添加页脚,您需要实现
-(UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section.
在你的UITableViewDelegate中。在该方法中,您可以创建并返回自定义页脚视图