複数の行を選択したオプションでテーブルビューを作成しています。ということで、チェックマークのアクセサリー系アクションを使ってみました。また、選択した行のテキストを編集/名前変更する必要があります。
基本的に、セルの左側にチェックマーク (チェックボックス) を配置し、セルの右側に詳細開示を配置する必要があります。どちらも機能します。
以下のコードは私が持っているチェックマーク用です。現在、セルの右側にチェックマークが表示されています。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
TSIPAppDelegate *appDelegate = (TSIPAppDelegate *)[[UIApplication sharedApplication]delegate];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSString *cellText = cell.textLabel.text;
if (cell.accessoryType==UITableViewCellAccessoryNone)
{
cell.accessoryType=UITableViewCellAccessoryCheckmark;
appDelegate.selectedFile = cellText;
if (prevSP!=indexPath.row) {
cell=[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:prevSP inSection:0]];
cell.accessoryType=UITableViewCellAccessoryNone;
prevSP=indexPath.row;
}
}
else if (prevSP!=indexPath.row){
cell.accessoryType=UITableViewCellAccessoryNone;
}
}
何か提案はありますか?
行を選択し、チェックマークを有効/無効にし、開示ボタンを選択すると、選択した行を編集するための新しいビューが開きます。