|Jan 22, 2013, 06:43 PM||#1|
I have a navigation-type app where you start with a root viewController, and other views get pushed
onto the stack.
Question is, if my app uses Game Center in more than one view, should I allocate my GameCenter manager
as a singleton, so I can access it from everywhere, or should I allocate a new instance per view?
The problem I have with using a singleton, is that my GameCenter manager requires that
I setup a delegate. But, only one view can be set as its delegate. So, if I were to use it with
multiple views, it would mean I would have to change the delegate everytime I change the view.
Is this safe to do? Does it follow any kind of design practice?
Last edited by lastcall; Jan 22, 2013 at 09:27 PM.
|Jan 28, 2013, 07:43 AM||#2|
If you have a navigation controller that pushes views that all use Game Center, you could have the class that creates the Navigation Controller be the delegate. In this case I assume the app delegate. You could then use the call back in the app delegate to grab the navigation controllers current view controller that would allow you handle events in that class alone. Therefore you would only set the delegate once and which ever view you were on would get the forwarded event form the app delegate.
"Innovation distinguishes between a leader and a follower." : S.J.
|Jan 29, 2013, 04:45 PM||#3|
How do I determine what is the active view controller from the app delegate?
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Gamecenter problem||Warhawk15||iPhone and iPod touch Apps||2||May 28, 2014 10:46 PM|
|Gamecenter help ?||Gmerdude||iOS 6||0||Jan 14, 2013 03:41 PM|
|Gamecenter multiplayer with me anyone?||AbhiKap55||iPod touch||0||Oct 20, 2012 02:38 PM|
|Any improvements to the GameCenter?||Eckscaliber||iOS 6||7||Oct 15, 2012 06:59 PM|
|GameCenter||SRRM||OS X 10.8 Mountain Lion||6||Jul 26, 2012 05:04 PM|
All times are GMT -5. The time now is 01:09 PM.