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