UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 30, 50)];
[imageView setImage:[UIImage imageNamed:@"111-user.png"]];
[tableView setTableHeaderView:imageView];
[imageView release];
有人能告诉我如何将第二张图片放入setTableHeaderView?
答案 0 :(得分:1)
创建一个新的UIView
,其中包含UIImageView
个实例:
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(...)];
UIImageView *firstImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 30, 50)];
[firstImageView setImage:[UIImage imageNamed:@"111-user.png"]];
[headerView addSubview:firstImageView];
[imageView release];
//do same thing with another UIImageView...
[tableView setTableHeaderView:headerView];
[headerView release];
答案 1 :(得分:0)
使用2个UIImageViews创建一个UIView,并将UIView添加到tableHeaderView。
[编辑]
由于您仍然遇到问题,我已经完成了一个快速测试项目,因此您可以看到它是如何工作的。您可以从此处http://bit.ly/fvJgiz
下载