2013年2月2日土曜日

[iOS][Xcode4.5]StoryBoard上でsegueを使わないで、コードで画面遷移


他の記事が少し古くてわかりにくかったことと、
自分で作成時にも何度も利用したので、ちょっと丁寧にメモ。


segueにつなげていない、とび先の画面で、classとstoryboardIDを設定
画面では、
class: RegisterationViewController
StoryBoardID: registeredで登録



とぶ前のControllerの中で、飛び先のclassをインポート
#import "RegisterationViewController
とぶ前のControllerの中でボタンが押された時のIBActionの中に、 飛び先のcontroller名とIdentifierを設定。
- (IBAction)registeredButton:(id)sender {
 RegisterationViewController *mycontroller = [self.storyboard instantiateViewControllerWithIdentifier:@"registered"];
 [self presentViewController:mycontroller animated:YES completion:nil];
}

これだけです!
簡単でしょ−!