在我的回合制游戏中,我有一个屏幕显示我目前参加的所有比赛。我为此使用了一个包含 3 个部分的表格 View 。
现在我想在显示的游戏上方添加一个“开始新游戏”按钮。在显示游戏的下方,我想要一些按钮,例如“商店”等。我可以放置它们,但它们不会滚动,所以我需要将它们放在 tableview 中以便它们滚动。
最好的方法是什么?
最佳答案
UIView *headerContainer = [[UIView alloc]initWithFrame:CGRectMake(X, X, X, X)];
UIButton *btnHeader = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[headerContainer addSubview:btnHeader];
UIView *footerContainer = [[UIView alloc]initWithFrame:CGRectMake(X, X, X, X)];
UIButton *btnFooter = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[footerContainer addSubview:btnFooter];
tblView.tableHeaderView = headerContainer;
tblView.tableFooterView = footerContainer;
关于iphone - 在 UITableView 的顶部和底部添加按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14350263/