2
A
回答
3
在该方法中
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
你需要创建一个UIView
并添加其他视图一样UIImageView
(图像),UILabel
(为标题),最后返回UIView
。
8
- (UIView *)tableView : (UITableView *)tableView viewForHeaderInSection : (NSInteger) section {
UIImageView *imgVew = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"header"]];
return imgVew;
}
通过这个,你可以设置图片为背景的tableview节头!
0
请使用此代码:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIImage *myImage = [UIImage imageNamed:@"loginHeader.png"];
UIImageView *imageView = [[[UIImageView alloc] initWithImage:myImage] autorelease];
imageView.frame = CGRectMake(10,10,300,100);
return imageView;
}
+0
不适合我。 100pt的高度不适用 – 2013-06-05 10:09:34
1
我用这个代码:
-(void)viewDidLoad
{
[super viewDidLoad];
self.tableView.tableHeaderView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"header"]];
}
+0
由于某种原因,我无法完成他的工作 – Shailesh 2015-12-27 15:12:59
0
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIImage * image = [UIImage imageNamed:@"logo-big.png"];
UIImageView * imgview = [[UIImageView alloc]initWithImage:image];
imgview.frame = CGRectMake(0, 0, 200, 200);
imgview.backgroundColor = [UIColor blackColor];
return imgview;
}
相关问题
- 1. 将图表标题和轴标题添加到分组图表
- 2. 将标题添加到列表视图
- 3. 将标题和图像添加到NSStatusItem
- 4. 添加标题和图标图像QProgressDialog
- 5. 如何将图像和标签添加到UINavigationBar作为标题?
- 6. 如何将图像替代和标题标签添加到wordpress图像
- 7. 将图像和标题添加到UIsegmentControl IOS
- 8. 将URL添加到Photoswipe图像标题
- 9. 将图像添加到Wordpress标题
- 10. 添加标题到Android列表视图
- 11. 添加图像到表单标题
- 12. 将表中的图像对齐并添加标题标题行
- 13. 如何在标题文本后的网格视图标题中添加图像
- 14. UITableView为图像图标添加标题
- 15. 添加图像标题
- 16. 将标题和子标题添加到维恩图
- 17. flexslider图像如何添加标题
- 18. 如何添加带有下标的表格视图节标题?
- 19. 在UITableview的标题视图中添加动态图像到UIView
- 20. 如何将图像添加到android 3.0的标题栏?
- 21. 如何将图像添加到标题的末尾?
- 22. 如何添加标题部分到Android中的列表视图?
- 23. 如何在JFrame的标题栏中添加图像图标?
- 24. 添加标题,注释和图像
- 25. 如何将标签图标和标题添加到分割视图中的标签项目
- 26. 如何将两个按钮添加到UINavigation栏标题视图
- 27. 添加图片和标题
- 28. 如何将图像添加到ListView列标题?
- 29. 如何使用SyndicationFeed将标题图像添加到RSS?
- 30. 如何将图像添加到tableview“标题”中?
你指的是在的tableView或公共首标段的标头,TableView中 – tGilani 2012-08-06 07:03:04
头的顶部只有部分。 – Feroz 2012-08-06 07:09:48