Interface Builder and switching UIViews - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Interface Builder and switching UIViews (/thread-2567.html)
Interface Builder and switching UIViews - bruss14 - Jun 20, 2008 10:01 AM
Okay, I have what seems like should be a stupid question, but I just can't seem to get it.
I am rewriting a game I did back before the Interface Builder was in the iPhone SDK. I created a new project using SDK beta 7. It sets up a project now with a MainWindow and a ControllerView. I'm trying to use that first view to have a button to start the game and take you to another view where the game is actually drawn and played.
I can't seem to get that to work though. How do I switch views? The documentation suggests putting each view in its own nib and then loading it as needed. I can't seem to get that to work. I've tried various things such as setting the ViewController.view to be a [[UIView alloc] initWithNibName@"GameView" bundle:nil]; But that terminates from an uncaught error. I created a new IB file with just a View in it and called that file GameView.
Playing in the code seems fine and straight forward to me. Trying to interact with the UI is getting to be very frustrating though.
Interface Builder and switching UIViews - AnotherJake - Jun 20, 2008 10:23 AM
We cannot talk about these specifics because we are all under NDA during the beta.
That said, the way I've been doing it is: I don't bother loading multiple nibs for simple interfaces, I just add views (to an existing view) and take them away as necessary. I don't dare say with what methods I actually do that, but if you look in your "view" documentation hopefully it should be pretty obvious what I'm hinting at.
One thing I might suggest, since it is public knowledge that it's in the iPhone: Learn how to use CoreAnimation with the UI stuff, it can make things *much* easier on you. Just read through the relevant documentation on it a few times (it isn't very long or complicated) and go over the sample code a bunch, and you should be able to pick it up pretty easy -- only took me a few hours to figure it out. Wish I could say more.
Interface Builder and switching UIViews - bruss14 - Jun 20, 2008 12:29 PM
Seems dumb that it's under NDA and it's freely available to anyone.
Well, that seems to work. Basically what I was doing before, but with two views! I was hoping to use Interface Builder, but I still can't seem to get it to let me do it.
I read about CoreAnimation a while back, can't think how that'd really help with what I'm currently planning to do, but thanks for the suggestion anyway.
Interface Builder and switching UIViews - AnotherJake - Jun 20, 2008 12:52 PM
Glad you got it working!
I'd like to say exactly why I suggested the CA thing, but:
bruss14 Wrote:Seems dumb that it's under NDA and it's freely available to anyone.
I agree, seems pretty dumb. The only rational reason I've been able to come up with to explain it is that maybe they don't want people talking about broken features during the beta period which might somehow unfairly garner some bad press?
At least it should be over with soon.