UIViewController作为一个单例 [英] UIViewController as a singleton
本文介绍了UIViewController作为一个单例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在选项卡栏应用程序中有一个UIViewController.我已经从MainWindow.nib文件中添加了控制器(即不是以编程方式).
I have a UIViewController in a tab bar application. I've added the controller from the MainWindow.nib file (i.e. not programatically).
我的问题是如何使我的视图控制器成为一个单例?(以解决Facebook委托问题).
My question is how can I make my view controller a singleton? (To resolve the Facebook delegate issue).
推荐答案
您可能希望使"Facebook连接代码"成为单例(或应用程序委托的一部分),而不是视图控制器本身.然后,只需将FB事物与需要它的任何视图控制器连接起来即可.
You probably want to make your "Facebook connection code" a singleton (or part of the app delegate), but not the view controller itself. Then just wire up the FB thing with any view controller that needs it.
这篇关于UIViewController作为一个单例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文