4
A
回答
1
試一試,
UIImageView *backgroundCellImage=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 80)];
backgroundCellImage.image=[UIImage imageNamed:@"ImageName.png"];
[cell.contentView addSubview:backgroundCellImage];
[backgroundCellImage release];
13
在cellForRowAtIndexPath
方法Add:
cell.imageView.image = [UIImage imageNamed:@"img.png"];
和完蛋了!真的很簡單!
如果您使用的是自定義單元格,那麼您需要將ImageView添加到IB中的自定義單元格中。然後創建,連接和合成一個IBOutlet它和這個代碼添加到cellForRowAtIndexPath
方法:
cell.yourImageOutlet.image = [UIImage imageNamed:@"img.png"];
4
在cellForRowAtIndexPath method
只需添加圖像..
cell.imageView.image = yourImage;
1
要麼你可以通過添加的UIImageView到所需的位置設置它的框架...
UIImageView *postImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 34, 300, 225)];
postImage.image = [UIImage imageWithData:data];
[postImage setContentMode:UIViewContentModeScaleAspectFill];
postImage.clipsToBounds = YES;
[cell addSubview:postImage];
[postImage release];
,或者你可以用下面的代碼也去...
cell.myImageView.image = [UIImage imageNamed:@"image.png"];
cell.imageView.contentMode = UIViewContentModeCenter;
1
只需使用:
如果您正在使用UITableViewCellStyleDefault那麼你並不需要定製的tableviewcells的外觀。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
// Configure the cell...
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.imageView.image=[UIImage imageNamed:@"ImageName.png"];
[email protected]"Text";
return cell;
}
相關問題
- 1. UItableview中的圖像
- 2. 的MonoTouch的UITableView與圖像
- 3. 浮動UITableView圖像?
- 4. uitableview重複圖像
- 5. UITableView的背景圖像 - iOS
- 6. 帶圖像的動態UITableView
- 7. 圖像的UITableView細胞
- 8. 對齊UITableView中的圖像
- 9. UITableView Cell上的圖像
- 10. NSCache存儲圖像的UITableView
- 11. UitableView圖像到全屏
- 12. 設計UITableView背景圖像
- 13. UITableView圖像導致崩潰
- 14. 在UITableview中顯示圖像
- 15. 查詢圖像到UITableView
- 16. 用圖像加載UITableView?
- 17. UITableView造成圖像放大
- 18. UITableView覆蓋/隱藏圖像?
- 19. HJCache UITableView重疊圖像
- 20. 從uitableview拖動圖像
- 21. 解析上傳圖像UItableview
- 22. UITableView背景圖像問題
- 23. UITableView中顯示多圖像
- 24. UITableView不顯示圖像
- 25. 添加圖像到uitableview cell
- 26. Swift - UITableView滯後於圖像
- 27. UITableView延遲大圖像
- 28. 在UITableView中緩存圖像
- 29. UITableview的滾動更改UIButton的圖像,UITableview滾動問題
- 30. UITableView爲圖像圖標添加標題
是圖像查看背景圖像或左側的圖標? – OMGPOP