2013-07-16 5 views
2

나는 아래와 같이 UITableViewController를 사용하여 여러 항목을 선택했다. 이것은 UIAlertView의 델리게이트 메소드로, UIAlertView에 Table이 있습니다.Array에 여러 개의 cell.textLabel.text를 어떻게 추가합니까?

이제 특정 선택된 indexPath.row를 배열에 추가하고 일부를 선택 취소하면 제거 할 수 있습니까?

- (void)tableAlert:(SBTableAlert *)tableAlert didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

NSLog(@"MY INDEX PATH IS %@", indexPath); 


if (tableAlert.type == SBTableAlertTypeMultipleSelct) { 
    UITableViewCell *cell = [tableAlert.tableView cellForRowAtIndexPath:indexPath]; 
    if (cell.accessoryType == UITableViewCellAccessoryNone) 
     [cell setAccessoryType:UITableViewCellAccessoryCheckmark]; 
    else 
     [cell setAccessoryType:UITableViewCellAccessoryNone]; 

    [tableAlert.tableView deselectRowAtIndexPath:indexPath animated:YES]; 
} 
} 

답변

0

tableView에 사용 된 항목의 사전을 만들려고합니다. 그런 다음 사전에있는 각 객체에 대해 'selected'bool 속성을 갖습니다. 경고보기가 탭될 때 이것을 true 또는 false로 설정하고 [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];을 사용하면됩니다. 그런 다음 행을 선택하는 객체를 알아야 할 경우 열거 할 수 있습니다.

관련 문제