[新手求助]preference中如何建立选择列表?如下图。


查了一下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的方法?万分感谢

	<dict>
		<key>cell</key>
		<string>PSLinkListCell</string>
		<key>default</key>
		<string>A</string>
		<key>defaults</key>
		<string>com.xxx.qqq</string>
		<key>key</key>
		<string>hunyin</string>
		<key>label</key>
		<string>婚姻状况</string>
		<key>detail</key>
		<string>PSListItemsController</string>
		<key>validTitles</key>
		<array>
			<string>单身</string>
			<string>已婚</string>
			<string>保密</string>
		</array>
		<key>validValues</key>
		<array>
			<string>A</string>
			<string>B</string>
			<string>C</string>
		</array>
	</dict>

如上面所说。另外iPhoneDevWiki有完整的各个键值描述

之前用自己方法也实现了,只不过比这麻烦一点。前两天没空,今天试了一下,working great ! 谢了

确实是搜过iPhoneDevWiki,可能是我漏掉了,谢谢