轉帖http://blog.csdn.net/yqmfly/article/details/46772529
現在在iOS開發中,有三種開發UI的方式,純代碼,xib,storyboard。我是喜歡用純代碼開發的,但是項目中總會有人用其他的方式,那么怎么進行跳轉呢?下面分別介紹
1,跳轉到xib
假設有一個按鈕,這個按鈕就是實現跳轉的,那么在這個按鈕的點擊事件中,代碼可以這樣寫。
AViewController *a1= [[AViewController alloc]initWithNibName:@”AViewController” bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:a1 animated:YES];
2,跳轉到storyboard
如上,代碼可以這樣寫
UIStoryboard *sb=[UIStoryboard storyboardWithName:@”A” bundle:nil];
[self presentViewController:[sb instantiateInitialViewController] animated:YES completion:nil];