我有一个UITableView有两个部分。第一部分可以有16行,第二部分可以有9行。我有两个自定义viewHeaders用于带有标题和自定义bakground的部分。
可以设置并将标题部分保持在像这张图片一样的确定位置吗?然后只显示几行,并滚动显示这个,但保持屏幕中间的节标题?
答案 0 :(得分:0)
在一个tableViewController中添加两个tableView。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == myTableView1) {
// cell for tableView 1
} else {
// cell for tableView 2
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
if (tableView == myTableView1) {
//return header section 0
} else {
// return header section 1
}
像这样设置所有委托方法。
如何修复身高?
在viewDidAppear
集
[tableView1 setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height/2)];
[tableView2 setFrame:CGRectMake(0, self.view.frame.size.height/2, self.view.frame.size.width, self.view.frame.size.height/2)];