你的位置:首页 > 软件开发 > 操作系统 > 用代码调用Storyboard里面的viewController

用代码调用Storyboard里面的viewController

发布时间:2015-08-19 15:00:06
今天在帮助群里的一个朋友弄pop事件,在他那边,当前的viewcontroller,不能pop出去。  初步估计,他的ViewController层级多,他自己没有理清。  因为pushViewController的时候,是执行栈入的原则,先进后出,后进先出。  比如A-> ...

  今天在帮助群里的一个朋友弄pop事件,在他那边,当前的viewcontroller,不能pop出去。

  初步估计,他的ViewController层级多,他自己没有理清。

  因为pushViewController的时候,是执行栈入的原则,先进后出,后进先出。

  比如A->B->C->D,他这个时候,想popB,但是B的上面还有两个,分别为C和D,C和D没有出来,这个时候,B就没有办法出来。所以,即使执行了pop语句,也达不到pop的效果。

  

  然后中午我自己用storyboard拖了几个东西,简单实现了这个效果,发现自己对storyboard还是不太熟,要仔细实践啊!

 

  1.  调出storyboard方法:
UIStoryboard * mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

Parameters

name

The name of the storyboard resource file without the filename extension. This method raises an exception if this parameter is nil.

storyboardBundleOrNil

The bundle containing the storyboard file and its related resources. If you specify nil, this method looks in the main bundle of the current application.

Return Value

A storyboard object for the specified file. If no storyboard resource file matching name exists, an exception is thrown with description: Could not find a storyboard named 'XXXXXX' in bundle....

Discussion

Use this method to retrieve the storyboard object containing the view controller graph you want to access. All of the resources associated with the storyboard must be in the bundle indicated by the storyboardBundleOrNil parameter.


 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:用代码调用Storyboard里面的viewController

关键词:ie

ie
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。