Go Back   iPhone Dev SDK Forum > Development Forums > iPhone SDK Tutorials

Featured Member Applications

TanZen ($0.99)

Endless Walls ($0.99)

Air Hockey ($0.99)

SUPER STRIKE - Motion Bowl ($0.99)

BarSlot ($0.99)

MeterRead ($0.99)

Colorblind Helper ($4.99)

gContacts ($1.99)

ProgCalc ($1.99)

Forex On The Go Lite (FREE)

HUE knewit! ($0.99)

Want your application to be advertised here?

» Advertisements


Visit our friends over at The App Show! Steve and Dave produce a weekly show shining a light on the iPhone 2.0 software and the applications being developed by the amazing development community for the iPhone SDK!
» Online Users: 108
16 members and 92 guests
CommanderData, detz, drifter7508, eddit, EPage_Ed, freshking, John, keyboardcowboy, lapse, MrsReznor, np@iphone, qjkbanks, RickMaddy, scotopia, stanfrnkln, uprise78
Most users ever online was 207, 10-24-2008 at 09:29 AM.
» Stats
Members: 3,912
Threads: 5,612
Posts: 23,243
Top Poster: scottiphone (705)
Welcome to our newest member, guy7373
Reply
 
LinkBack Thread Tools Display Modes
Old 08-02-2008, 11:07 AM   #1 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 299
Default Multiple XIB how-to

I created this screen-cast yesterday to help out those who have been wondering how to use multiple XIB files in their projects. The link is below, and don't hesitate to let me know what you think. The video was recorded in 720p and was converted into MP4. You should be able to view it full screen without too much distortion.

Chris asked me to come back and embed the videos in these pages. But I didn't realize until I did it that the embedded versions weren't HiDef. However, you can click the link below the video to be taken to vimeo.com and you can view it in HiDef from there, or you can click the download link and download a HiDef version to your computer. All the videos except for this one are 75-ish meg in size.


iPhone Tutorial - Multiple XIB files from Nick Myers on Vimeo.
Download HiDef Version to your computer

Last edited by myersn024; 09-04-2008 at 10:51 AM.
myersn024 is offline   Reply With Quote
Old 08-05-2008, 06:50 PM   #2 (permalink)
Junior Member
 
Join Date: Aug 2008
Posts: 6
Default

I think the implementation you showed in the video may not be the best example of good MVC (Model-View-Controller) design pattern practice. I am no pro either, but I dont think you should be accessing the application delegate from a UIView subclass, this sort of thing should probably handled by a controller object, such as your UIViewController subclasses. then they need to be hooked up in IB accordingly.

Thanks for the tutorial, I did learn a lot and I appreciate it.
aoberoi is offline   Reply With Quote
Old 08-05-2008, 11:17 PM   #3 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 299
Default

I see your point, but I don't see how you can get around having a lot of extra fluff in your programs if you make your UIViews access their view controllers to access data that the view controllers get from the delegate. The "proper" implementation also makes for more work. I'm a big believer in the idea that the easier you make something, the better.

Then again, I always got counted off on my programming assignments when I was in college because I wouldn't do things the way they were "supposed" to be done. I had several assignments where I lost points for not following the assignment, only to have them added back on for thinking outside the box....not that this is the same type of situation, but the code works and is rather minimal. In the end, do it however you're comfortable.

Thanks for the compliments and constructive criticism.
myersn024 is offline   Reply With Quote
Old 08-06-2008, 02:59 AM   #4 (permalink)
Hello
 
Join Date: May 2008
Posts: 49
Default

I really liked how you used the delegate in this tutorial, thanks for this. Like others I would have probably used the view controller for most of the stuff, but I think whenever I have the opportunity I will use the delegate now.
Ilyace is offline   Reply With Quote
Old 08-06-2008, 04:55 PM   #5 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 299
Default

@aoberoi: Not to be a stick in the mud over your comments, but I went back and looked over Apple's example code for table views and their samples store the content array in the delegate and access them the same way that I do it in the tutorial. In the end, it all comes down to being able to access your content from anywhere in your program. If you store it in a view controller instead of the delegate, then you're still going to have to access across classes regardless of your implementation. Therefore, the delegate makes the most sense.
myersn024 is offline   Reply With Quote
Old 08-07-2008, 02:56 AM   #6 (permalink)
Junior Member
 
Join Date: Aug 2008
Posts: 6
Default

Oh I agree completely that the application delegate is implemented correctly.

My difference of opinion (and thats all it is) is where the methods such as sayHi and tellDelegateToFlipView should be implemented. I think there should be outlets for these methods in View Controller classes. These classes typically implement the functionality of items placed in the Views. To communicate with data used by the whole application, yes it makes sense to go to the app delegate.

In this small example, an easy to understand method does have its obvious advantage. I am only commenting that in order to use the principles of the design pattern, technically the functionality of those buttons should be moved to a view controller. Otherwise, one might ask, why did I have to make a class file for the view controllers? I never used them right? Also, if it was implemented the way I suggested, there would be no need to make source files for either of the Views, and less source files to me means easier to understand.

Last edited by aoberoi; 10-14-2008 at 11:01 PM.
aoberoi is offline   Reply With Quote
Old 08-07-2008, 05:48 AM   #7 (permalink)
Member
 
Join Date: Jul 2008
Posts: 54
Talking

I've just seen the video and I think it is great! I really like the way you coment your code and how you thought on doing the presentation in general. I'm just a beginer, but I feel I understand most of what you said.

Having said that, one thing I still don't quite understand is the MVC design pattern, and reading on your comments here, I feel quite lost. At the moment I'm just doing things so I get the apps working, but I keep feeling I'm not doing things correctly. The problem with this is when I come back in a few months, maybe it will be hard to read my code (not that I'm really going to do that, I hope I know much more than now). The point is that I think the understanding of the MVC is important for readability and reuse, specially if working with other people.

All of this is to say that if one day you feel bored, could you make a video on MVC ? Well, either that or could you point me were to read to better understand it all?

Thanks and keep up the good work!
jazzmic is offline   Reply With Quote
Old 08-07-2008, 08:49 AM   #8 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 299
Default

Quote:
Originally Posted by aoberoi View Post
Oh I agree completely that the application delegate is implemented correctly.

My difference of opinion (and thats all it is) is where the methods such as sayHi and tellDelegateToFlipView should be implemented. I think there should be outlets for these methods in View Controller classes. These classes are typically implement the functionality of items placed in the Views. To communicate with data used by the whole application, yes it makes sense to go to the app delegate.

In this small example, an easy to understand method does have its obvious advantage. I am only commenting that in order to use the principles of the design pattern, technically the functionality of those buttons should be moved to a view controller. Otherwise, one might ask, why did I have to make a class file for the view controllers? I never used them right? Also, if it was implemented the way I suggested, there would be no need to make source files for either of the Views, and less source files to me means easier to understand.
Touché, sir....touché.
myersn024 is offline   Reply With Quote
Old 08-11-2008, 11:06 AM   #9 (permalink)
ZipZest.com
 
Join Date: Aug 2008
Posts: 44
Default

Thanks for the tutorial - its excellent!
mikeb is offline   Reply With Quote
Old 08-19-2008, 02:24 AM   #10 (permalink)
Junior Member
 
Join Date: Aug 2008
Posts: 1
Smile Multiple XIM how-to

Very Informative Video . Good for Beginners.

Nice work.

--Vinay Mehta
vinay.mehta is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Powered by vBadvanced CMPS v3.0.1

All times are GMT -5. The time now is 02:31 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0