選択した を変更しようとしていますUITableViewCell
が、ここで少し奇妙なことが起こっています。2枚の画像を配置しました。ご覧ください:
「早い」セルを選択すると、青色に変わります。それは「初期の何とか」に移動しUIViewController
ます。次に、「検索」をUIButton
押すと、最初のビューに戻ります。動作しますが、セルはまだ青く選択されています! だから私は以下のようにいくつかのコードを書きました:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if ([_currentMethod isEqual: @"searchIt"]) {
if (indexPath.row == 0) {
BookMark2ViewController* bookMark2 = [[BookMark2ViewController alloc] init];
UITableViewCell* cell = [self tableView:_tableView
cellForRowAtIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[self.navigationController pushViewController:bookMark2 animated:YES];
}else if (indexPath.row == 1) {
BookMarkViewController* bookMark1 = [[BookMarkViewController alloc] init];
[self.navigationController pushViewController:bookMark1 animated:YES];
}
}
コードの真ん中にある 2 行:
UITableViewCell* cell = [self tableView:_tableView
cellForRowAtIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
この 2 行は機能しませんでした。これを修正する方法を知っている人はいますか?