Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

ios - Storyboard reference in Xcode, where should we use it?

There is one new control in Xcode7 beta named as Storyboard Reference. Below is its image.

enter image description here

It has its description as

Provides a placeholder for a view controller in an external storyboard. Segues connected to this placeholder will instantiate the referenced view controller at runtime.

So the questions are

  1. In which situations should we use this?
  2. Is this used to connect two storyboard's view controllers via segue?
  3. Is this approach used to replace VC of another storyboard programatically?
  4. Will it work on older iOS version(before iOS 9)?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

UPDATE (January 6, 2016): I just want to quickly mention that using Storyboard references is very simple and is going to help you use Storyboards in a much more clean and maintainable way. A good use case for it is e.g. a UITabBarController with multiple tabs. Just create one Storyboard for each tab and in your Main.Storyboard link to those individual Storyboards using Storyboard references. Usage is very straightforward: after creating a Storyboard reference you only need to give it the filename of the individual Storyboard that you want to link to and set the initial view controller within that individual Storyboard. That's it! :)

What follows now is the original answer I gave to @YogeshSuthar's question.

  1. this can be used in cases where you are using multiple storyboards in your app. until now you'd have to instantiate view controllers from other storyboards programmatically, seems like now you can just use this reference and create your segue in the storyboards just like with view controllers from the same storyboard

  2. yes, you connect one view controller from your current storyboard with another view controller from a different storyboard and you can create a segue between these two

  3. yes, this can be used to replace the code that was formerly used to instantiate view controllers from other storyboards programmatically

  4. [UPDATE thx to @AlexBasson] Storyboard references can deployed to iOS 8, OS X 10.10 and watchOS 1.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...