★ TouchArcade needs your help. Click here to support us on Patreon.

Still learning (pt2) - How to change views

01-30-2009, 01:58 PM
#11
Joined: Sep 2008
Location: Birmingham, UK, dull corner of the world
Posts: 2,367
Quote:
Originally Posted by Schenk Studios View Post
Glad I could help. If you run into problems, check capitalization and check your connections in IB.
Hehe! Funny you should mention that- I had to start over. I named my class with a small 's' (settingMenuViewController) and it caused problems when you have commands using the lower case version which conflicted. I Tried to change names over, and still got error messages, so I am in the process of starting again. Shouldn't take long now... hopefully

When I get to the animation part, is there a way to choose which side the new view comes in from?
01-30-2009, 02:31 PM
#12
Joined: Sep 2008
Location: Birmingham, UK, dull corner of the world
Posts: 2,367
DONE IT!! Looks great! I'll go over what we did a few times so I understand exactly how it was done (I more or less understood everything I think).

Thanks again. Maybe this thread will help others learn these things too. There aren't any sample codes that show you this particular function!

01-30-2009, 03:07 PM
#13
Quote:
Originally Posted by wastedyuthe View Post
When I get to the animation part, is there a way to choose which side the new view comes in from?
Take a look at a Utility app. New Project >> iPhone >> Utility (instead of view based). That has plenty of code to dig through!
01-31-2009, 01:49 PM
#14
Joined: Sep 2008
Location: Birmingham, UK, dull corner of the world
Posts: 2,367
Yay! My book has finally arrived now! ("Beginning iPhone Development" by Dave Mark and Jeff LaMarche)

I have skipped forward to the chapter on handling multiple views, and its example project actually uses multiple nib files. I know it can obviously be done with one now (thanks to the wonderful help I have been given so far), but I am now wondering- what would be the advantage of each view having their own nib (.xib) file over them all sharing one as we have done? Is there an advantage, does it depend on what those views do, or is it just personal preference?

If it's a case of using more nib files to help keep them organized, I thought of maybe using one for the menus, and another for the actual gameplay. What do you think?

Last edited by wastedyuthe; 01-31-2009 at 01:54 PM.
01-31-2009, 03:32 PM
#15
It is a matter of organizational preference and also a matter of when you want that xib to load. Everything that you put in the default xib will be loaded during the application startup, "eager approach". Optionally you can load views after the application has started up. This will cause the app to start up faster, (since it isn't loading everything from the get go) but it may cause pauses when you're users are going from view to view since it has to do the loading then "Lazy Approach". In the end, chances are either approach will suffice so pick one and run with it!
01-31-2009, 03:41 PM
#16
Joined: Sep 2008
Location: Birmingham, UK, dull corner of the world
Posts: 2,367
Fantastic advice, thanks. So, with a small game, you may as well load it all together with one xib file straight away. But with larger games it may be better to seperate sections into seperate xib files.
I think with my first game, one xib file will be adequate enough to load it all at startup as it won't be particularly complex enough to warrant splitting into further loads.
Sound about right?
01-31-2009, 04:40 PM
#17
Sounds good. The book that I learned on and is still being added to is, http://www.pragprog.com/titles/amiph...dk-development
01-31-2009, 04:44 PM
#18
Joined: Sep 2008
Location: Birmingham, UK, dull corner of the world
Posts: 2,367
Thanks (hehe! Are you getting fed up of me saying that yet? You're just too helpful my friend). Downloaded the free screencast episode introducing Xcode and IB etc. But I won't be buying the book as I already have the one delivered today plus another on the way. The one you gave a link to does look good though.

Last edited by wastedyuthe; 02-01-2009 at 05:07 AM.