1

난 네비게이션 컨트롤러 앱에서 탭 바 앱으로 만드는 앱을 변환했다.didselectrowatindexpath와 관련된 문제

모든 것은이 한 가지와 별개로 작동합니다. 내 탭 중 첫 번째는 테이블보기를 가져오고, 사용자가 셀을 선택하면 다른보기 컨트롤러 (예 : 이 네비게이션 응용 프로그램)

을 때 그것은했다 그러나 이것은 더 이상 내가 문제는 self.navigationController

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    [tableView deselectRowAtIndexPath:indexPath animated:NO]; 


    StoryDetailViewController *storyDetailViewController = [[StoryDetailViewController alloc] initWithNibName:@"DetailView" bundle:nil]; 



    WorldCupAppDelegate *appDelegate = [UIApplication sharedApplication].delegate; 

    Story *aStory = [appDelegate.stories objectAtIndex:indexPath.row]; 
    NSURL *url = [NSURL URLWithString:aStory.picture]; 
    NSData *data = [NSData dataWithContentsOfURL:url]; 
    UIImage *img = [[UIImage alloc] initWithData:data]; 
    storyDetailViewController.downloadedImage = img; 


    storyDetailViewController.story = [appDelegate.stories objectAtIndex:indexPath.row]; 


    [self.navigationController pushViewController:storyDetailViewController animated:NO]; 

    NSLog(@"view controller pushed"); 

    [StoryDetailViewController release]; 
} 
+0

"뷰 컨트롤러가 눌려져 있습니다"... ...가 인쇄됩니까? 및 [tableView deselectRowAtIndexPath : indexPath animated : NO]; 이 줄은 함수의 마지막 줄이어야합니다 ... –

답변

3

어리석은 일을하고 일을 보인다. 더 이상 내비게이션 컨트롤러의 일부가 아니기 때문에 navigationControllernil입니다. 새 뷰를 계층에 푸시하려는 경우 루트 뷰 컨트롤러로 해당 뷰가있는 탐색 컨트롤러를 만든 다음 대신 탐색 막대의 뷰를 탭 표시 줄에 추가하면됩니다.

+0

brilliant, thanks –