Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 24, 2008, 02:48 PM   #1
Enuratique
macrumors 6502
 
Join Date: Apr 2008
[iPhone] Which way do you instantiate Views?

I'd like to get a feel for how people here build up their Views. All the samples I am using as a basis override the loadView method and build by hand their views... This seems tedious, especially with the nice Interface Builder app. So, to give some background - I used the View based application template when first creating the project. Then, in Interface Builder, I added a SearchBar and a UITableView object to my View. Then I defined two IBOutlets for each of the elements (SearchBar and UITableView) so that I could access them in the ViewController.m file. Finally, with the IBOutlets defined, I could Ctrl+Drag from each of my defined outlets in the View's attributes inspector to each of the UI elements. This saved me the work of having to manually allocate the View, and set the window's view with it. The downside is now I can't figure out how to invoke the ViewController's init method I have written for it. All I want to do in the ViewController's init is alloc/init my custom DataSource so that in my viewDidLoad override, I can set the UITableView's dataSource to this instance. Now, I suppose I can just allocate and instantiate it right there in the viewDidLoad method, but there's got to be a cleaner way, right?

How would you go about this? Thanks,

Enuratique
__________________
24" Aluminum iMac, 2.8 GHz, 4 GB RAM, 500 GB HD, 8800 GS; Black 32GB iPhone 4; Black 30GB 5th Gen iPod
Enuratique is offline   0 Reply With Quote
Old Jun 24, 2008, 07:53 PM   #2
lucasgladding
macrumors 6502
 
Join Date: Feb 2007
Location: Waterloo, Ontario
 
see vendor information in user profile
awakeFromNib is likely what you are looking for. Check the class documentation for NSObject for the method.
__________________
Lucas Gladding
Development/Interface Design/Illustration
www.cashdepositapp.com | www.ledgerapp.com
www.dribbble.com/lucasgladding
lucasgladding is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Smart Cover: Which way do you fold it? BergerFan iPad 2 Sep 16, 2011 12:35 PM
Tethering on a iPhone 3GS? How do you connect your Mac to wifi via your iPhone 3GS? Ulf1103 iPhone 6 Aug 14, 2011 10:26 PM
Which stylus do you use & which apps do you use it with? El3ctronics iPad Accessories 21 Apr 5, 2011 08:25 PM
Which Hand Do You Hold Your iPhone With When You Speak? EgbertAttrick iPhone 9 Jul 14, 2010 08:42 PM


All times are GMT -5. The time now is 09:39 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC