私は各セルが90.0fの高さ(高さ)であるtableVIewを持っています。私のコード。TableViewセルの出現の問題
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 90.0;
}
ここで、テーブルのすべてのレコードを削除します。セルの高さは44(私は思う)のデフォルト値に縮小します。
1.)私の問題は、ユーザーがすべてのレコードを削除した後でもセルの高さを90.0fに維持する必要があるということです。私はこれをプログラム的にどのようにすることができますか?
2.)私は自分の細胞に2色を与えました。
cell.contentView.backgroundColor = indexPath.row % 2 ? [UIColor whiteColor] : [UIColor blackColor] ;
iは黒色である第二のセルを削除すると、その後、第1および第3のセルの両方が白です。どのように私はこれを注文して白黒に並べ替えることができますか?
EDIT:
[OK]を、私は
-[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1448.89/UITableView.m:961
と
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. Attempt to delete more rows than exist in section.'
[tableview indexPathsForVisibleRows]
これはなぜですか?
CODE:
[self.tableView beginUpdates];
[self.myArray removeObjectsInArray:discardedItems ];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:YES];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:YES];
[self.tableView endUpdates];
を提供してください。 –
そこに他の色がありましたので、私はそれを投稿するように変更しなければなりません – sharon