0
셀을 선택하면 View 컨트롤러를 푸시하는 단순한 그룹화 된 테이블보기가 있습니다. 탐색 모음의 왼쪽 항목은 테이블보기를 "편집 모드"로 전환합니다. 편집 모드에서 원하는대로 각 셀을 이동하고 삭제할 수 있습니다. 내가 원했던 것은 그것이 편집 모드이고 일반 모드 일 때 별도의 View 컨트롤러를 푸시 할 수 있다는 것입니다.TableView가 편집 중일 때 다른 ViewController가 호출되었습니다.
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
...stuff that doesnt matter...
[[self navigationController] pushViewController:detailViewController animated:YES];
}
BarButtonItems 여기에 선언되고있다 :
이
은보기 컨트롤러가 추진되고있는 곳이다[[self navigationItem] setLeftBarButtonItem:[self editButtonItem]];
이 모든 편집 물건이 선언 된 곳이다 :
- (void)tableView:(UITableView *)atableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[atableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation: UITableViewRowAnimationFade];
}
}
- (void)tableView:(UITableView *)atableView
moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath
toIndexPath:(NSIndexPath *)destinationIndexPath
{
[[BNRItemStore sharedStore] moveItemAtIndex:[sourceIndexPath row]
toIndex:[destinationIndexPath row]];
}
도움을 주셔서 감사하지만 그 doesnt는 작동하는 것처럼 보입니다. 내가 편집 모드에서 나는 테이블 컨트롤러를 선택하지 못했지만 뷰 컨트롤러를 만들었지 만 (atableView.editing) {NSLog (@ "편집")}과 피드백을받지 못하면 ... – user1438042