0
A
回答
6
繼承UITableViewCell
來製作自定義單元格。可以說它叫做MyCustomCell
。
使用它像下面
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// In your case it has to be the custom cell object here.
MyCustomCell *cell = (MyCustomCell*)[tableView dequeueReusableCellWithIdentifier:@"AnIdentifierString"];
if (cell == nil)
{
cell = [[[MyCustomCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"AnIdentifierString"] autorelease];
}
//use your cell here
// cell.textLabel.text = @"This text will appear in the cell";
return cell;
}
你可以重寫的init與MyCustomCell
風格的多幅圖像
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
//change frame sizes to palce the image in the cell
UIImageView * thumbnail1 = [[UIImageView alloc] initWithFrame:CGRectMake(17, 12, 62, 62)];
thumbnail1.image = [UIImage imageNamed:@"Icon.png"];
[self addSubview:thumbnail1];
UIImageView * thumbnail2 = [[UIImageView alloc] initWithFrame:CGRectMake(17, 12, 62, 62)];
thumbnail2.image = [UIImage imageNamed:@"Icon.png"];
[self addSubview:thumbnail2];
UIImageView * thumbnail3 = [[UIImageView alloc] initWithFrame:CGRectMake(17, 12, 62, 62)];
thumbnail3.image = [UIImage imageNamed:@"Icon.png"];
[self addSubview:thumbnail3];
}
return self;
}
相關問題
- 1. 如何在WPF Datagrid的單元格中添加多個圖像?
- 2. 在UITableView中添加多個自定義單元格
- 3. 在jqxgrid單元格中添加圖像
- 4. 在UITableView中添加/減去單元格
- 5. Objective-c UITableView單元格圖像疊加
- 6. 圖像自動添加到UItableView單元格中?
- 7. UITableView的單元格中每行有多個圖像
- 8. 添加一個UIPickerView到UITableView單元格
- 9. UITableView與單元格中的圖像
- 10. 延遲加載UITableView與每個單元格中的多個圖像
- 11. 在XCode中添加單元格到表格視圖(UITableView)
- 12. 如何在UITableView單元格中添加標籤和圖像視圖的數量
- 13. UItableview添加新單元格後,前一個單元格消失
- 14. 多個單元格圖像
- 15. UITableView多個單元格
- 16. 如何添加圖像到UITableView單元格?
- 17. 顯示在UITableView中添加更多單元格
- 18. PHPExcel單元格中的多個圖像
- 19. UITableView中的多個原型單元格?
- 20. 檢查UITableView中的多個單元格
- 21. 在UItableview中爲每個單元格添加一個開關
- 22. 在MGWT中添加文本和圖像每個單元格單元格
- 23. 在uitableview單元格中加載異步圖像
- 24. 的UITableView單元格添加按鈕
- 25. 如何在UITableView單元格中添加UITableView?
- 26. UITableView單元格的圖像更改?
- 27. 刪除多個單元格後,uitableview添加了一些行
- 28. 將單元格添加到uitableView中像Mail.app
- 29. 如何在圖像中像這樣添加表格視圖中的單元格?
- 30. 「過濾」UITableView中的單元格。多個視圖?子視圖?
如下,請格式化代碼,讓別人瞭解 –
好,我發現了一個教程[鏈接](http://www.icodeblog.com/2008/09/02/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-2/)謝謝。 –
如果我有像第一個單元格中的數據,我有7個圖像,並且我想在一個單元格中顯示第一個3圖像,第二個單元格中顯示另外3個圖像,第三個單元格中剩餘1個圖像,那麼我該怎麼做......?任何解決方案......? – TheMall