2012-08-09 6 views
0

저는 현재 객관적인 C를 배우고 있고 다른보기로 테이블보기에서 segue를 만들려고합니다. 코드는 prepareForSegue 함수에서 충돌합니다.segue from TableView

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ 
if([segue.identifier isEqualToString:@"rowSelected"]){ 
    UIViewController *nextViewController = segue.destinationViewController; 
    nextViewController.title = @"newView"; 
    } 
} 


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
[self performSegueWithIdentifier:@"rowSelected" sender:self]; 
} 

나의 이해 SEGUE 준비를 위해를 heres 코드

내가이 다음 뷰를 초기화한다는 것이다 (?). 하지만 대부분의 자습서에서는 prepareForSegue 내에 몇 가지 구성 만 설정했습니다.

잘못된 일을하는 것이 있습니까? 또는 누군가가 tableview + segue 가이드를 연결하여 내가 따라 잡고 내가 잘못한 것을 찾을 수 있습니다.

을 heres 오류 메시지가 실제로 시도 정보를 yourSomethingArray이 코드에서 위의 발견이 코드

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ 
if([segue.identifier isEqualToString:@"rowSelected"]){ 
    UIViewController *nextViewController = segue.destinationViewController; 
    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; 
nextViewController.title = [YourSomethingArray objectAtIndex: indexPath.row]; 
    } 

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[notesViewController length]: unrecognized selector sent to class 0x469c' 
+0

오류는 사용자가 파일을 요청하고 있음을 의미합니다. 하나도없는 객체의 ngth 속성 나는 당신의 코드에 아무런 문제가 보이지 않는다. – Dustin

+0

그게 PrepForSegue에있는 것입니까? – Moxy

답변

0

안녕하세요 피타를 포함하는 것으로, 적어도 일부

cell.textLabel.text = yourSomethingArray[indexPath.row];