基本的に、他のUIViewControllerによって提示するUIViewControllerにStoryBoardIDを割り当てることができます。
次に、表示するUIViewControllerの.hファイルの先頭にUIViewControllerサブクラスをインポートする必要があります。たとえば、ここに表示するBaseViewControllerとInfoViewControllerを示します。
#import <UIKit/UIKit.h>
#import "InfoViewController.h"
@interface BaseViewController : UIViewController
{
InfoViewController *InfoViewController;
}
@property (nonatomic, strong) InfoViewController *InfoViewController;
次に、.mファイルでそれを合成し、コードを入力して実装する必要があります。ここでは、 ShowInfoActionという名前のIBActionでInfoViewControllerを表示するためのボタンを使用しています。
@synthesize InfoViewController = _InfoViewController;
- (IBAction)ShowInfoAction:(id)sender {
InfoViewController *InfoVC = [self.storyboard instantiateViewControllerWithIdentifier:@"GiveItAnIDHere"];
[self presentViewController:InfoVC animated:YES completion:NULL];
}