ios4、ios5界面跳转

ios4、ios5在跳转上有些区别:

push跳转(ios4、ios5):

SearchDetailViewController *sView = [[SearchDetailViewController alloc] init];
        [self.navigationController pushViewController:sView animated:YES];
        [sView release];//ios5不需要这行


push需要头部有navigationControll才能跳转,普通ViewControll是不能跳转的,普通ViewController只能用Modal进跳转。

modal跳转(ios4、ios5):

ZbarViewController *zVC = [[ZbarViewController alloc] initWithNibName:@"ZbarViewController" bundle:nil];
    [self presentModalViewController:zVC animated:YES];

//传参(写在跳转后面)

zVC.flag = true;


返回到上一界面:

[self.navigationController popViewControllerAnimated:YES];//push

[self dismissModalViewControllerAnimated:YES];//modal


ios5由于运用了storyboard又多了几种跳转方式:

手动跳转

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

PriceRecordViewController *prVC = [mainStoryboard instantiateViewControllerWithIdentifier:@"priceRecord_ID"];
        prVC.auctionIdStr = auctionIdStr;
        [self.navigationController pushViewController:prVC animated:YES];


如果运用了storyboard可如下跳转:

[self performSegueWithIdentifier:@"biddingTOauctionDetail" sender:auctionIdStr];

sender用于发送需要传的对象。

用storyboard跳转传值方法:

//场景传值(传多个值)
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    AuctionDetailsViewController *advc = segue.destinationViewController;
    advc.auctionIdStr = sender;
    advc.speedBidTypeStr = speedBidTypeStr;
}

你可能感兴趣的:(apple,cocoa,Objective-C)