2012-08-16 5 views
0

마스터 - 세부 응용 프로그램이 있습니다. 사용자가 마스터 테이블에서 행을 선택하면 DetailViewController가 아닌 다른 테이블을 열고 자합니다. iPad의 Facebook 응용 프로그램과 비슷한 MasterViewController 외에도 종이 여야합니다.스토리 보드의 사용자 정의 세그먼트

MasterViewController에서이 테이블 (사용자 지정 UITableViewController의 DocumentViewController)에 대한 Custom Segue가 있습니다. 이 DocumentViewController는 네비게이션 컨트롤러에 '임베디드'되어 있습니다. 한마디로

,이 같은 내 스토리 보드 모양의 항목 :

navigationController-> MasterViewController-> navigationController-> DocumentViewController.

segue는 MasterViewController에서 navigationController까지입니다.

"didSelectRowAtIndexPath"에서 segue를 수행해야합니까? 아니면 didSelectRowAtIndexPath에서 "performSegueWithIdentifier"를 사용해야합니까?

답변

1

질문을 올바르게 이해하면 Segue가 MasterViewController에서 DocumentViewController로 바뀌어야합니다. 고유 한 식별자를 부여한 다음 MasterViewController의prepareForSegue 012에서 수행 할 작업을 참조하십시오.

예 :

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    if ([[segue identifier] isEqualToString:@"showList"]) { 

     // gets indexPath for the currently selected row in my UITableView 
     NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; 

     // pull back some useful data from Core Data according to what was selected in my UITableView. 
     NSManagedObject *object = [[self fetchedResultsController] objectAtIndexPath:indexPath]; 

     // listDataItem is a property of the controller (in this case a UITableViewController) 
     [[segue destinationViewController] setListDataItem:object]; 
    } 
} 
+0

이 날 MasterVC 왼쪽으로 이동하고 DocumentVC가 MasterVC 외에 앉아 그래서 내가 SEGUE를 "애니메이션"수있는 방법 DocumentViewController.But에 데이터를 보내 도움이 될 것입니다? – user1550951

+0

@NetToiOS, 이것은 좋은 출발점 일 수 있습니다. http://stackoverflow.com/questions/9348605/custom-segue-with-uiviewanimationoptiontransitioncurldown. 또한 도움이된다면 대답을 수락하십시오. – FilmJ

+0

샘플은 UIViewController를 사용합니다. MasterViewController와 DocumentViewController는 UITableViewController를 사용할 수 있습니까? 그리고 ... 대답을 수락했습니다 : – user1550951

관련 문제