:最後の行が削除されているときに編集モードを終了についてExit Edit Mode退出編集モードとナビゲーションバーのアイテムを更新
は、私の質問は - どのようにナビゲーションバー「編集」の項目を更新していますか?最後の行を削除した後、このナビゲーションバーの項目をすべて削除して編集モードを終了します(これは以下の質問ごとに行います)。このボタンのステータスを「編集」に戻します最後の行を削除した後)。私が今やっている何ザッツ
:
- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
...
if ([section count] == 0) { //last row in the section
[listOfItems removeObject:accessNumbers]; //updating my data source
tblSimpleTable.editing = NO; //added per the question above
// self.navigationItem.rightBarButtonItem = nil; --> thats what ideally i would want to do
// [self setEditing:YES animated:YES]; --> adding this manually doen't help
}
else
{
...
}
}
}
は助けてくれてありがとう!
更新:この行を追加することは役に立ちません。編集モードを終了するには、ナビゲーションバーの項目「Done」をクリックする必要があります。
[self.tblSimpleTable setEditing:YES animated:YES];
ナビゲーションバーの項目を非表示にしても、編集モードを終了できず、画面がフリーズしてしまいます(この場合、他のボタンも表示されます) 。 、すべて一緒に使用するボタンを削除するには
[self.tableview setEditing:NO animated:YES];
:
// Note that this only removes the right-most button. If you want to remove all of the buttons on the right side, use rightBarButtonItems instead.
self.navigationItem.rightBarButtonItem = nil;
// If you want it animated, use:
[self.navigationItem setRightBarButtonItem:nil animated:YES];
私は恐れています... [self。テーブルビューsetEditing:いいえアニメーション:はい];編集モードを離れるように見えません - 画面はフリーズしています(他のボタンはアクティブではありません)。ナビゲーションバーからボタンを削除するとうまくいきますが、新しい行を追加すると、ボタンは(期待通りに)表示されますが、「完了」と表示され、「編集」ではなく表示されます – TommyG
これは正しく表示されますが、元の投稿によって提供されます。 – danh
私はトリガリングについてはかなり確信しています - 最後の行が削除されたときにのみ、これに入ります。私が説明した問題以外にも、最後の行が削除された後にnav bar itemが消えるなど、すべてが完璧に機能します。 – TommyG