Objective c UItableview头视图与自定义uiview?

Objective c UItableview头视图与自定义uiview?,objective-c,ios,uitableview,uiview,Objective C,Ios,Uitableview,Uiview,我正在创建一个自定义uiview,其中包含分配给uiimageview的uilabel和uiimage。我将自定义uiview分配给uitableview头视图,但我只看到uilabel而不是uiimage…请帮助这是我的代码 UIView *containerView1 =[[UIView alloc]initWithFrame:CGRectMake(0, 0, 300, 30)]; UILabel *headerLabel1 =[[UILabel alloc]initWithFrame:C

我正在创建一个自定义uiview,其中包含分配给uiimageview的uilabel和uiimage。我将自定义uiview分配给uitableview头视图,但我只看到uilabel而不是uiimage…请帮助这是我的代码

UIView *containerView1 =[[UIView alloc]initWithFrame:CGRectMake(0, 0, 300, 30)];

UILabel *headerLabel1 =[[UILabel alloc]initWithFrame:CGRectMake(75, 4, 300, 20)];
    headerLabel1.userInteractionEnabled = YES;
    headerLabel1.text = [NSString stringWithFormat:@"- Latest update %@ -", now];
    headerLabel1.textColor = [UIColor brownColor];
    headerLabel1.shadowOffset = CGSizeMake(0, 1);
    headerLabel1.font = [UIFont boldSystemFontOfSize:13];
    headerLabel1.backgroundColor = [UIColor clearColor];

    UIImage *image = [UIImage imageNamed:@"line_seperator.png"];
    UIImageView *imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(0.0, 0.0, 30, 30)];

    imageView.image = image;
    imageView.contentMode = UIViewContentModeScaleAspectFit;

    [containerView1 addSubview:headerLabel1];
   [containerView1 addSubview:imageView];
    [containerView1 addSubview:indicator2];

   walltable.tableHeaderView = containerView1;
谢谢你的帮助


忘了说这段代码在uitableview加载后执行。

我找到了它。图像不正确。该图像是以.gif格式从web下载的。我在photoshop中打开它并将其保存为.png,但它没有正确保存。我在photoshop中创建了一个新图像,并复制了新图像中的图像。我将它保存为.png,并且它工作正常。

尝试self.tableView.tableHeadView=containerView1