|Jun 24, 2008, 03:48 PM||#1|
[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,
24" Aluminum iMac, 2.8 GHz, 4 GB RAM, 500 GB HD, 8800 GS; Black 32GB iPhone 4; Black 30GB 5th Gen iPod
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Finder help (views)||jamgam||OS X Mavericks (10.9)||2||Dec 19, 2013 11:59 AM|
|iPhone/iPad app that views pictures/videos on WIN PC?||vivithemage||iPhone and iPod touch Apps||2||Dec 10, 2012 12:26 AM|
|NavController and 5 views||mngoose||iPhone/iPad Programming||10||Sep 30, 2012 02:43 AM|
All times are GMT -5. The time now is 02:07 PM.