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. 將圖像和標題添加到UIsegmentControl IOS
- 3. 將URL添加到Photoswipe圖像標題
- 4. 添加標題到Android列表視圖
- 5. 添加圖像到表單標題
- 6. 將表中的圖像對齊並添加標題標題行
- 7. UITableView爲圖像圖標添加標題
- 8. 在UITableview的標題視圖中添加動態圖像到UIView
- 9. 如何將圖像添加到標題的末尾?
- 10. 如何將圖像添加到android 3.0的標題欄?
- 11. 添加標題,註釋和圖像
- 12. 添加圖片和標題
- 13. 如何將圖像添加到ListView列標題?
- 14. 如何使用SyndicationFeed將標題圖像添加到RSS?
- 15. 如何將圖像添加到tableview「標題」中?
- 16. 如何將圖標添加到導航抽屜中的標題?
- 17. 將背景圖像添加到木星4 WordPress主題標題
- 18. 如何將圖像鏈接到標題
- 19. 將標題和圖像添加到導航欄
- 20. 將圖像和標題添加到導航backBarButtonItem
- 21. 動態添加組和標題到可擴展列表視圖
- 22. 將標題添加到SAS輸出圖
- 23. Qt,如何將圖標添加到tabWidget標題?
- 24. 將幫助圖標添加到WinForms表單標題欄
- 25. 如何將圖像標題添加到我的PHP郵件表單中?
- 26. 如何將圖像添加到視圖
- 27. 如何將圖像添加到ios objective c中的uiactivityindicator視圖?
- 28. 將標題添加到Http標題
- 29. 將標題/標題添加到telerik Radgrid?
- 30. 在UITableView中的標題標題旁邊添加圖像
你指的是在的tableView或公共首標段的標頭,TableView中 – tGilani 2012-08-06 07:03:04
頭的頂部只有部分。 – Feroz 2012-08-06 07:09:48