自定义标题视图不起作用

时间:2014-05-01 08:31:06

标签: ios tableview

在我的应用程序中,我使用了自定义标题视图。在视图中有三个标签。当我加载表时,它没有正确显示标题视图。

http://content.screencast.com/users/seemaagile/folders/Default/media/bfff3f2f-9e05-4431-8ca3-5f554204095c/Screen%20Shot%202014-05-01%20at%201.55.52%20PM.png

任何人都可以为我解决这个问题吗?

编辑:

for (int i = 0; i < appDelegate.arySongs.count; i++) {

    id data = [[appDelegate.arySongs objectAtIndex:i] valueForKey:@"media"];

    if([data isKindOfClass:[MPMediaItem class]]){

        [self.aryHeaders addObject:[self createCombineHeader:i isMediaItem:YES]];
    }
}

[tblview reloadData];

-(HeaderView*)createCombineHeader:(int)headerNumber isMediaItem:(BOOL)isMediaItem
{

    NSLog(@"creating header number %d",headerNumber);


    NSMutableDictionary *dictData = [[NSMutableDictionary alloc]init];

    dictData = [appDelegate.arySongs objectAtIndex:headerNumber] ;

    HeaderView *headerView = [[HeaderView alloc]init];

    //CellHeader *headerView = [[CellHeader alloc]initWithNibName:@"CellHeader
    [headerView.view setFrame:CGRectMake(0, 0, 320, 44)];

    [headerView.view setBackgroundColor:[UIColor whiteColor]];

    [headerView.view setTag:headerNumber];
    return headerView;
}

0 个答案:

没有答案