回答
不要ü想設置背景圖片爲您的表或在UITableView的 單個細胞如果是用於設置背景圖片,然後執行以下操作:
UIImage *bgImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"background.png" ofType:nil]];
UIColor *bgColor = [[UIColor alloc] initWithPatternImage:bgImage]; self.view.backgroundColor = bgColor;
[tableName setBackgroundColor:[UIColor clearColor]];
其中tablename是你的UITableView的名稱
如果你想設置背景圖片的UITableView單元格,然後執行以下操作:
cell.backgroundColor = [UIColor clearColor];
UIImageView *cellBG_tap = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image.png" ofType:nil]]];
cell.backgroundView = cellBG_tap;
[cellBG_tap release];
設置在小區的一類,然後用CSS把背景圖像,如下圖所示:
<table class="myTable">
<tr>
<td class="myCell"></td>
</tr>
</table>
<style>
.myCell {
background: url(my_image.gif)
}
</style>
很確定@kiran意味着使用UITableViewCell而不是網頁。 – Jordan 2010-10-19 06:47:57
這個問題在「iPhone」下標記,而不是HTML或CSS。 – 2010-10-19 06:48:09
我的不好。應該更仔細地紅色。 – 2010-10-19 06:48:47
一種方法是修改的UITableViewCell的內容查看。例如:
//Add custom objects to the cell in here!
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.jpg"]];
imageView.center = CGPointMake(310, 48);
[cell.contentView addSubview:imageView];
[email protected]"test";
設定背景圖片
UIImageView* img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"yourImage.png"]];
[cell setBackgroundView:img];
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
cell.textLabel.font =[UIFont systemFontOfSize:20.0];
cell.detailTextLabel.textColor=[UIColor whiteColor];
cell.detailTextLabel.font = [UIFont systemFontOfSize:15.0];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
cell.imageView.image = [UIImage imageNamed:@"Square.gif"];
}
在表視圖數據源
cellForRowAtIndexPath
if (indexPath.row%2==0) {
UIImageView *img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"image..."]];
cell.backgroundView=img;
[img release];
我用這它的工作
.... @all感謝人們貢獻自己的知識
- 1. 在桌面背景上只顯示桌面背景上的winform
- 2. 如何將桌面背景圖像保存到c#文件中?
- 3. 桌面視圖鈦的背景圖像
- 4. 如何將視頻顯示爲桌面背景(在XP中)?
- 5. 背景圖像不顯示的面板
- 6. 如何顯示的圖像爲背景
- 7. 不顯示背景圖像
- 8. 背景圖像不顯示
- 9. Matlab - 顯示背景圖像
- 10. 背景圖像不顯示
- 11. 不顯示背景圖像
- 12. 背景圖像顯示
- 13. 不顯示背景圖像
- 14. 背景圖像dosnt顯示
- 15. 不顯示背景圖像
- 16. 將不會顯示CSS背景圖像
- 17. 圖像與背景圖像不顯示
- 18. 如何顯示桌面背景變暗的窗體?
- 19. 如何設置多個桌面背景(雙顯示器)
- 20. CSS:在子背景圖像上顯示父級背景圖像
- 21. 滾動背景,直到整個背景圖像顯示
- 22. JavaFX顯示器場景背景圖像
- 23. 如何將背景圖像添加到平面圖?
- 24. 如何使用angular1將圖像顯示在正面/背面?
- 25. 將圖像帶到背景
- 26. 在python 2.7透明背景窗口在桌面上顯示圖像
- 27. 如何將.gif作爲背景圖像顯示?
- 28. 將用作啓動圖像fullscreend的圖像顯示爲背景
- 29. 將背景圖像添加到現有的背景圖像
- 30. 如何顯示備用圖像,如果背景圖像沒有找到
在設置單元格的backgroundColor前設置cell.backgroundColor = [UIColor clearColor] – Swapna 2010-10-19 11:07:44
@ swapna謝謝 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath :(NSIndexPath *)indexPath {cell_textLabel.font = [UIFont systemFontOfSize:20.0]; \t cell.detailTextLabel.textColor = [UIColor whiteColor]; \t cell.detailTextLabel.font = [UIFont systemFontOfSize:15.0]; \t cell.textLabel.backgroundColor = [UIColor clearColor]; \t cell.detailTextLabel.backgroundColor = [UIColor clearColor]; \t cell.imageView.image = [UIImage imageNamed:@「Sapphire Square.gif」]; } - 用於以上代碼工作。謝謝所有 – 2010-10-19 12:22:01