2012年5月22日 星期二

UINavigatorController

終於到左NatvigationController

NatvigationController 會儲住一個stack 而呢個stack 既elements 係一堆viewControllers



















Push 推elements 入stack
Pop 拎elements 出stack
Top 最尾既element 都係第一個pop出黎
Base 最頭一個element


//push to next controller

    if (childController == nil) {
        childController = [[BIDDisclosureDetailController alloc]
                           initWithNibName:@"BIDDisclosureDetail" bundle:nil];
    }

//set childController properties
    childController.someMessage = detailMessage;
    childController.title = selectedMovie;
    [self.navigationController pushViewController:childController
                                         animated:YES];

[self.navigationController pushViewController:nextController animated:YES];

//pop (go back) to previous controller
[self.navigationController popViewControllerAnimated:YES];

//The view controllers currently on the navigation stack.
NSArray *allControllers = self.navigationController.viewControllers;

//retrieve last controller pushed into stack
UITableViewController *parent = [allControllers lastObject];

//reload data of parent tableview
[parent.tableView reloadData];

沒有留言:

張貼留言