查了一下PSTableCell有个
@property (nonatomic, getter=isChecked) BOOL checked ;
,但是不知道这种cell选择后怎么更新的plist配置,也查看了开源项目,有的是通过- (void)loadView
方法自定义tableview,但是我这边总是闪退,代码:
@interface ThemeListController : PSListController <UITableViewDelegate, UITableViewDataSource>
//@property (nonatomic, strong) NSArray * cellArrays;
@end
@implementation ThemeListController
- (instancetype)init {
self = [super init];
if (self) {
[self setTitle:@"选择音量主题"];
}
return self;
}
- (void)loadView {
self.title = @"选择音量主题";
UITableView *table = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
table.delegate = self;
table.dataSource = self;
self.tableView = table;
self.view = self.tableView;
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 40;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *cellReuse = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellReuse];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellReuse];
}
{
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 20 - 20, 0, 20, 20)];
imageView.image = [UIImage imageNamed:@"themeSelected"];
// imageView.backgroundColor = [UIColor lightGrayColor];
imageView.center = CGPointMake(imageView.center.x, CellHeight/2.0);
[cell.contentView addSubview:imageView];
}
return cell;
}
@end
大神们,有没有什么简便的方法?或者直接配置cell的plist的方法?万分感谢