문제

I have a UIViewController in my Storyboard that can have one of two layouts, depending on which setting the user chose.

One uses a UITableView to display the information, while the other uses UICollectionView.

In code, I'd simply set up the view controller depending on the setting, but I don't see how I would do this with a Storyboard. How do I handle the multiple layouts in a Storyboard environment? (Worth mentioning this view controller is embedded in a navigation controller.)

도움이 되었습니까?

해결책

This situation is no different than any time you have to make a choice in an app as to which controller should be shown next. Have two different navigation controllers (with storyboard identifiers) set up in the storyboard, one whose root view controller has the table view, and the other with the collection view. After the user makes a choice, instantiate the correct navigation controller, and segue to it, or make it the window's root view controller.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top