設定方法カスタム編集スタイルアイコンにUITableViewCellを編集モード
-
20-09-2019 - |
質問
はありませてカスタム編集スタイルアイコンのほか、緑のプラスの赤いマイナスにアイコンが可能な編集モード UITableView
?
いかをシミュレートの編集モードのアニメーションでの移動は細胞のコンテンツの追加UIImageViewがっている気がします。回避しようとするだろう
解決
唯一の方法をカスタマイズ編集スタイルの細胞を用い tableView:editingStyleForRowAtIndexPath: るを返す必要があUITableViewCellEditingStyle.
なし、削除(赤いマイナス)、挿入(グリーンプラス)のみです。から 文書:
セル編集スタイル
編集制御 使用される。
typedef enum { UITableViewCellEditingStyleNone, UITableViewCellEditingStyleDelete, UITableViewCellEditingStyleInsert } UITableViewCellEditingStyle;
他のヒント
コードの下に示すように、
あなたは返すことができます
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row == 0)
{
return UITableViewCellEditingStyleInsert;
}
else
{
return UITableViewCellEditingStyleDelete;
}
}
所属していません StackOverflow