Interface Builder and switching UIViews

Member
Posts: 50
Joined: 2008.06
Post: #1
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.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #2
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. Wink

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.
Quote this message in a reply
Member
Posts: 50
Joined: 2008.06
Post: #3
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! Smile 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.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #4
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. Annoyed
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Question about interface builder mag709 3 3,752 Apr 23, 2012 05:40 PM
Last Post: mag709
  Switching between UIViewContollers mberger 2 2,761 May 10, 2010 12:20 PM
Last Post: maximile
  How to instantiate a control in code instead of using Interface Builder ? Bracer 2 3,657 Nov 3, 2009 01:41 PM
Last Post: ThemsAllTook
  Switching to another EAGLView help. jeonghyunhan 2 2,793 Jul 6, 2009 11:37 PM
Last Post: AnotherJake
  Changing font type in Interface Builder? Toontingy 0 3,909 Mar 29, 2009 05:42 PM
Last Post: Toontingy