我想把一个按钮放到TableView的页脚上。在iPhone中使用圆形矩形按钮用于TableView页脚?
这就是我所做的,我看不到按钮,但显示字符串“RESULT”。
我试过了我能想到的一切。但我无法弄清楚什么是错的。我需要你帮忙!
- (void)viewDidLoad {
btnSeeResult = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btnSeeResult setTitle:@"RESULT" forState:UIControlStateNormal];
viewResult = [[UIView alloc] initWithFrame:btnSeeResult.frame];
[viewResult addSubview:btnSeeResult];
self.tableView.tableFooterView = btnSeeResult;
}
-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return viewResult.bounds.size.height;
}
总之,什么是直接设置像
tableView.tableFooterView = footerView;
页脚视图,并使用(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
方法之间的区别?
非常感谢您的回答。在我调用sizeToFit方法后,显示按钮。但它的高度完全适合它的字符串,但按钮会一直拖到左侧和右侧。我该怎么办?该死的我花了几天的时间用这个按钮! – SeniorLee 2010-12-25 13:58:51