在iOS開發(fā)中,有三種開發(fā)UI的方式,純代碼,xib,storyboard。我是喜歡用純代碼開發(fā)的,但是項(xiàng)目中總會(huì)有人用其他的方式,那么怎么進(jìn)行跳轉(zhuǎn)呢?下面分別介紹
1,跳轉(zhuǎn)到xib 假設(shè)有一個(gè)按鈕,這個(gè)按鈕就是實(shí)現(xiàn)跳轉(zhuǎn)的,那么在這個(gè)按鈕的點(diǎn)擊事件中,代碼可以這樣寫
AViewController *a1= [[AViewController alloc]initWithNibName:@”AViewController” bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:a1 animated:YES]; 2,跳轉(zhuǎn)到storyboard 如上,代碼可以這樣寫 UIStoryboard *sb=[UIStoryboard storyboardWithName:@”A” bundle:nil]; [self presentViewController:[sb instantiateInitialViewController] animated:YES completion:nil];