私は2つのviewControllerを持っています:
- DemoAppViewController
- ViewControllerについて
AboutViewControllerを開くはずのDemoAppViewControllerに情報ボタンがあります。
現時点では、実行時エラーが発生していますが、その理由がわかりません..
コードは次のとおりです。
DemoAppViewController .h:
- (IBAction)showInfo;
DemoAppViewController.m:
- (IBAction)showInfo {
AboutViewController *controller = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
//setting style with modalTransition property
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
//show on screen
[self presentViewController:controller animated:YES completion:nil];
}
xCode で AboutViewController オブジェクトを作成するとinitWithNibName
、次のコードが AboutViewController.m に追加されます。
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
上記はそのままにしておきました。
ランタイムエラー:
[DemoAppViewController showInfo:]: unrecognized selector sent to instance 0x688e450
誰かが私が間違っているところを教えてもらえますか? ありがとう。