2014-11-20 4 views
-2
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
     NSIndexPath *indexPath = [self.myTableView indexPathForSelectedRow]; 
     ThirdViewController *destViewController = segue.destinationViewController; 
     segue.destinationViewController displayTitlesArray = [[NSArray alloc]initWithObjects:@"first ",@"second",@"Third", nil ];} 

디스플레이 제목 배열은 다음보기 컨트롤러에서 배열입니다.하지만 여기에 오류가 발생합니다. segue.destinationViewController 개체를 사용하여 다음보기 컨트롤러에 데이터를 전달할 수 있습니다.스토리 보드에서 prepareSegue 메소드를 사용하는 방법은 무엇입니까?

+0

내가 왜 투표를 중단했는지 알 수 있습니까? – Pvni

+1

Google에서 검색 할 수있는 수많은 예제 또는 자습서가 있기 때문에 : http://www.appcoda.com/storyboards-ios-tutorial-pass-data-between-view-controller-with-segue/ –

+0

https : // www.google.co.in/search?q=How%20to%20use%20prepareSegue%20method%20in%20storyboard%3F&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox- & 채널 = fflb & gfe_rd = cr & ei = XsFtVKrCK-aq8weKxoHQBg – Kalpesh

답변

0
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
     NSIndexPath *indexPath = [self.myTableView indexPathForSelectedRow]; 
     ThirdViewController *destViewController = (ThirdViewController *)segue.destinationViewController; 
     destViewController.displayTitlesArray = [[NSArray alloc]initWithObjects:@"first ",@"second",@"Third", nil ];} 
관련 문제