我UITableView
在我的应用程序上进行了设置,该应用程序在iOS 7上运行.我有一个部分,它将图像加载到自定义单元格中,并在其下滚动navigation bar
,这是半透明的.所以最初,内容低于navbar
它,并在navbar
我们向下滚动以查看更多图像时滚动.为此,我设置了一个初始contentInset
值UIEdgeInsetsMake(40, 0, 0, 0)
.现在有时,我需要在我的桌子上使用一个小的标题视图来指示我桌子上的图像类型.所以我使用了以下代码:
-(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 30.0; } -(UIView*) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ TableSectionHeader *header=[[[NSBundle mainBundle] loadNibNamed:@"TableSectionHeader" owner:self options:nil] objectAtIndex:0]; [header.title setText:[NSString stringWithFormat:@"Type: %@", self.imageType]]; return head; }
TableSectionHeader
我为此目的创建的自定义视图在哪里.理想情况下,标题必须浮动或"粘贴" navbar
在表格的下方或顶部(位于导航栏下方).但在这种情况下,它只是滚出屏幕.我希望标题直接贴在navbar
.有谁知道我怎么能做到这一点?