8

I want to switch between multiple view controllers with a UIPageViewController. These view controllers are static though so i want to design them in my storyboard. Since one can't use relationships or segues to connect them to the UIPageViewController but a datasource, I need to have a datasource object with an IBOutletCollection holding the pages:

@property (retain, nonatomic) IBOutletCollection(UIViewController) NSArray* pages;

Although, I am not able to connect this outlet to the view controllers in question. I guess thats because view controllers in a story board are treated completely independently like they were in different nib files. Is there a solution though? I don't want to design these view controllers in code.

1 Answer 1

11

An IBOutlet is probably not the way to go about this. The best way to do so in my opinion would be to get the nib file using an identifier that you specify in storyboard and then in the viewDidLoad method, type this in and replace the variable name and identifier with the applicable names.

UIViewController *myController = [self.storyboard instantiateViewControllerWithIdentifier:@"myIdentifier"];

Hope this helped you get it working.

2
  • this worked fine for me, but i wont accept now since im still hoping to see another solution yet. Commented Jan 17, 2012 at 18:48
  • Marcus, but in Xcode 4.5 there is no identifier input in IB of storyboard. I am asking answer here: stackoverflow.com/questions/12471429/…
    – petesalt
    Commented Sep 18, 2012 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.