본문 바로가기

프로그램 경험/iOS

[iPhone] TableView의 전체 셀 접근하기 & 선택표시 사라지기

//NSArray의 데이터 개수만큼 순환하면서 각각의 TableViewCell 에 접근
for (int i=0; i < [menu count]; i++) {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
cell.accessoryType = UITableViewCellAccessoryNone;
if (i == [indexPath row]) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
//선택표시 사라지기
[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];