objective-c - 动态改变 UITableViewCell 的附属 View 图像

标签 objective-c ios cocoa-touch

我有一个 CustomTableView Cell,它有一个附属 View 。如何动态更改附件 View 的图像?

最佳答案

将您的自定义按钮用于附件 View ,例如..

//把铅笔图标贴在辅助 View 上

UIButton* pencil = [UIButton buttonWithType:UIButtonTypeCustom];
[pencil setImage:[UIImage imageNamed:@"icon-pencil.gif"] forState:UIControlStateNormal];
pencil.frame = CGRectMake(0, 0, 15, 15);
pencil.userInteractionEnabled = YES;
[pencil addTarget:self action:@selector(didTapEditButton:)      forControlEvents:UIControlEventTouchDown];
cell.accessoryView = pencil; 

关于objective-c - 动态改变 UITableViewCell 的附属 View 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13235768/

相关文章:

ios - 为什么XCTestCase会覆盖XCTest的setup方法?

objective-c - 将图像和滚动图标添加到 TableView 的逻辑

ios - GoogleCloudMessaging 链接错误

objective-c - 如何使用 Objective-C 解析 JSON?

ios - iPhone 6 Flexbox 包装问题

ios - 在 UITextField 中将部分文本设为粗体

iphone - NSURL连接超时

iphone - 如何在 iPhone 中以编程方式将按钮旋转 360 度?

ios - 报亭中提供的应用程序必须符合附表 1、2

objective-c - NSView 和动态加载 subview