Arp*_*ekh 4 iphone xcode objective-c
可能重复:
将图像添加到UItableView
我想在左侧的UITableView中添加图像,我该如何添加它?
Jon*_*asG 15
在cellForRowAtIndexPath方法中添加:
cell.imageView.image = [UIImage imageNamed:@"img.png"];
Run Code Online (Sandbox Code Playgroud)
这就是它!真的很容易!
如果您使用自定义单元格,则需要将ImageView添加到IB中的自定义单元格.然后为它创建,连接和合成IBOutlet,并将此代码添加到cellForRowAtIndexPath方法中:
cell.yourImageOutlet.image = [UIImage imageNamed:@"img.png"];
Run Code Online (Sandbox Code Playgroud)
只需在cellForRowAtIndexPath method..中添加图像
cell.imageView.image = yourImage;
Run Code Online (Sandbox Code Playgroud)
尝试这个 ,
UIImageView *backgroundCellImage=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 80)];
backgroundCellImage.image=[UIImage imageNamed:@"ImageName.png"];
[cell.contentView addSubview:backgroundCellImage];
[backgroundCellImage release];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11937 次 |
| 最近记录: |