目次

プロパティ

編集中も選択可能にする

セパレータのスタイルを設定する

セパレータを表示しない

	self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

行の更新

個別の行/セルを更新する方法

cell.textLabel.textにセットする

[cell setNeedsLayout]する

reloadRowsAtIndexPaths:withRowAnimation:を使う

UIViewControllerで使う

Tips

キーボードを閉じる

UITextFieldを使っている場合

トラブルシューティング

NSRangeExceptionが発生する

tableViewでinsertRowsAtIndexPathsとdeleteRowAtIndexPathsを実行。

		[self.tableView beginUpdates];
		[self.tableView insertRowsAtIndexPaths:insertPaths withRowAnimation:UITableViewRowAnimationTop];
		[self.tableView deleteRowsAtIndexPaths:deletePaths withRowAnimation:UITableViewRowAnimationNone];
		[self.tableView endUpdates];			

エラーが発生。

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableIndexSet addIndexesInRange:]: Range {2147483647, 1} exceeds maximum index value of NSNotFound - 1' [#vc4d76e4]

エラーメッセージの意味が分かりづらいが、indexPathがおかしいことが原因だった。beginUpdateとendUpdateで囲んで実行する場合、追加・削除前に存在するセクション、行を指定してNSIndexPathをつくらないといけない。そこを間違えていないか確認する。

行を更新しようとしてNSInternalInconsistencyExceptionが発生。


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-04-11 (月) 15:28:24