Creating Segues Links

How can I create a segue relationship? I would like to create a subclass of UIViewController similar to UITabBarController or UINavigationController , where, using Interface Builder, I can control + drag and drop from a view controller to another view controller. I tried

 @property (nonatomic) IBOutlet NSArray *viewControllers; @property (nonatomic) IBOutlet UIStoryboardSegue *root; 

and also tried to drag the Container View into my controller. When I do this, I can drag the views from one controller to another, but I can not drag it to multiple controllers. I also cannot find the documentation for the UIContainerView object.

+6
source share
1 answer

Segues relationships are handled by Interface Builder. You cannot create them manually if the initial view controller is not one of the ones you specified. The easiest solution for your problem is to create a TabBarController and hide its tab bar in the code.

Here's a pretty advanced tutorial about something very similar to what you are trying to do. You can get more ideas from him. http://www.freelancemadscience.com/fmslabs_blog/2012/9/24/advanced-storyboard-techniques.html

EDIT:

Thanks for the tip about using TabBarController, but I'm asking this question because I'm trying to subclass UIPageViewController so that I can create a PageViewController data source from IB

This is an interesting idea, and this solution is explained here: Using UIPageViewController in storyboards You do not need to subclass UIPageViewController, this contradicts the recommendations in the documentation. Create a class that implements the UIPageViewControllerDataSource delegate. Place the green cube in the list pane of the page view controllers and set its class to create a new one. Then drag it from the data source to this cube.

However, pages cannot be set visually in this way or in any other way. Unfortunately, it is not supported at all.

+4
source

Source: https://habr.com/ru/post/952771/


All Articles