小编Vis*_*ish的帖子

heightForHeaderInSection没有被调用?

我想改变tableHeader高度,字体等......

我实施UITableViewDelegate,UITableViewDataSource并添加heightForHeaderInSectionviewForHeaderInSection.但是这两种方法都没有被调用.其他方法如numberOfRowsInSection/ cellForRowAtIndexPath正在正常工作.我可以看到表但没有标题:(

任何的想法?

这是代码:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.poHeader.itemList count];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    NSLog(@"numberOfSectionsInTableView");
    return 1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    NSLog(@"*******height");
    return 44.0;
}


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    NSLog(@"***in viewForHeader In section");

    UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(2, 166, 300.0, 44.0)];
    UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    headerLabel.backgroundColor = [UIColor clearColor];
    headerLabel.opaque = NO;
    headerLabel.textColor = [UIColor blackColor];
    headerLabel.highlightedTextColor …
Run Code Online (Sandbox Code Playgroud)

uitableview ios

6
推荐指数
1
解决办法
5423
查看次数

标签 统计

ios ×1

uitableview ×1