嘿我正在创建一个必须在分组的tableview顶部显示大图像的应用程序,我不希望图像在tablecell中,因为它看起来很愚蠢。我只是希望图像漂浮在那里,但我不知道该怎么做?谢谢!
答案 0 :(得分:1)
使用表格视图的tableHeaderView
属性,如下所示:
UIImageView *topImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my logo.png"];
topImage.backgroundColor = [UIColor clearColor];
topImage.frame = CGRectMake(0, 0, theTableView.bounds.size.width, 100); // replace 100 with the height of your image, plus a bit if you want it to have a margin
topImage.contentMode = UIViewContentModeCenter;
theTableView.tableHeaderView = topImage;
[topImage release];