Storyboard」カテゴリーアーカイブ

StoryboardからViewControllerをオブジェクト化

//
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"{storyboardファイル名}" bundle:nil];
STHogeViewController *con = [sb instantiateInitialViewController];
//

関連情報 ストーリーボードファイル名

//
DataViewController *startingViewController = [self.modelController viewControllerAtIndex:0 storyboard:self.storyboard];
//
//
- (DataViewController *)viewControllerAtIndex:(NSUInteger)index storyboard:(UIStoryboard *)storyboard {
    // Return the data view controller for the given index.
    if (([self.pageData count] == 0) || (index >= [self.pageData count])) {
        return nil;
    }

    // Create a new view controller and pass suitable data.
    DataViewController *dataViewController = [storyboard instantiateViewControllerWithIdentifier:@"DataViewController"];
    dataViewController.dataObject = self.pageData[index];
    return dataViewController;
}
//