0

어떻게 데이터를 UINavigationController에서 루트 UITableViewController로 전달할 수 있습니까? ECSlidingViewController (https://github.com/edgecase/ECSlidingViewController)를 구현했습니다. 사용자가 다른 url에 해당하는 메뉴의 셀 중 하나를 선택합니다. UINavigationController 상단에 sitate라는 테이블 뷰에서 정보를 표시하려고합니다. (당신이 스토리 보드에 UINavigationController를 끌어다 놓는 기본 조합을 알고 있습니다.) 슬라이딩 메뉴에서 내 navigationController로 데이터를 가져올 수 있습니다. 이제는 내 tableview에서 동일한 정보를 전달하려고합니다. 내 메뉴에서Sliding 메뉴에서 UINavigationViewController를 통해 UITableViewController로 데이터 전달하기

내가 가진 :

UINaviationController에서
UINavigationController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"NavigationTop"]; 
    newTopViewController = [(NavigationTopViewController*)newTopViewController initWithCinema:self.myCinema]; 

: 내 jQuery과에서

- (id)initWithCinema:(Cinema *)cinema { 
    self = [super init]; 
    if(self) { 
     _myCinema = [[Cinema alloc] init]; 
     _myCinema = cinema; 
    } 
    return self; 
} 

- (void) viewDidLoad { 
    [super viewDidLoad]; 

    // this log works I get the info to here. 
    NSLog(@"url(navigation):%@", self.myCinema.cinemaURL); 

    //MoviesTableViewController *moviesTableViewController = [[MoviesTableViewController alloc] initWithCinema:self.myCinema]; 

    //UITableViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MoviesTable"]; 

    //NavigationTopViewController *newTopViewController = [[NavigationTopViewController alloc] initWithCinema:self.myCinema]; 
    //newTopViewController = [(MoviesTableViewController *)newTopViewController initWithCinema:self.myCinema]; 
    //[self performSegueWithIdentifier:nil sender:self.myCinema]; 
    [self prepareForSegue:nil sender:self.myCinema.cinemaURL]; 

} 

:

- (void)setCinema:(Cinema *)cinema { 
    // works here too 
    NSLog(@"Table(setCinema):%@", cinema.cinemaURL); 
    self.myCinema = [[Cinema alloc] init]; 
    if(!cinema) { 
     cinema.cityIndex = kAstanaIndex; 
     cinema.name = kKeruen; 
     cinema.nameForText = kKeruenText; 
     cinema.cinemaURL = kKeruenURL; 
     cinema.cinemaURLTomorrow = kKeruenURLtomorrow; 
    } 
    self.myCinema = cinema; 
    // works here too!!! 
    NSLog(@"Table(myCinema):%@", self.myCinema.cinemaURL); 
} 
의이있는 viewDidLoad에서 사라 그러나

:

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    // set delegate to self 
    self.tableView.delegate = self; 

    // set loading theater's url 


// does not work here: I GET NULL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
    NSLog(@"url(moviesTable):%@", self.myCinema.cinemaURL); 
    _model = [[MovieModel alloc] initWithURL:self.myCinema.cinemaURL]; 
} 

내가 시도한 방법 (내비게이션에서 댓글을 달았습니다 ...)은 적어도 나를 위해. 제발 제안 해줘. 미리 감사드립니다.

+0

설명을 위해'topViewController'가 루트 뷰 컨트롤러로'UITableViewController'를 가진'UINavigationController'로 설정되어 있습니까? 언더보기 컨트롤러 중 하나에서 테이블 뷰 컨트롤러로 데이터를 전달 하시겠습니까? –

답변

0

UINavigationController에는 데이터가 저장되지 않고보기 컨트롤러 스택이 있습니다. 무료 Sensible TableView 같은 프레임 워크를 체크 아웃하는 것이 좋습니다. 프레임 워크는 자동으로 상세 뷰 생성을 처리하고 이들 사이에서 데이터를 전달합니다. 내 프로젝트에 수없이 많은 개발 시간을 절약 할 수 있습니다.