Advertise Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Your First iPhone App
($1.99)

iPhone Code Generator
($9.99)

Calcuccino Programmers' Calculator
($2.99)

DataFon(Build Apps on Windows)
(free)

Infinote Pinboard for Todos and Notes
(free)

picplz
(free)

poG
($2.99)

Want your application or service advertised on iPhone Dev SDK?

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

Reply
 
LinkBack Thread Tools Display Modes
Old 08-10-2008, 09:02 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2008
Posts: 177
Default Question about initWithNibName

Let's say you have your basic View xib file, the file owner is a ViewController which you have class files for, and there is a View which has class files as well. You set a view outlet on the File Owner to the UIView using Interface Builder.

This is all loaded via another ViewController whose xib name is set to that View xib file.

Everything just loads automatically, there's no question about that. When you create a UIViewController class file, it gives you a built-in function called initWithNibName. I would assume this gets called in place of things like loadView or viewDidLoad.

I set a break point, but this is never getting called.

My problem is I'm trying to mimic the Accelerometer Graph example, but it's not working right when I load it on my phone. So I'm trying to bypass the accelerometer calls (since the simulator doesn't fire the events), and just draw my graph. I tried putting the draw method in initWithNibName, but like I said, it's not getting called.
skinrock is offline   Reply With Quote
Old 08-10-2008, 10:19 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 420
Send a message via AIM to jeff_lamarche Send a message via Yahoo to jeff_lamarche
Default

Any object instance that is loaded from a nib will get created using initWithCoder: because the nib contains serialized object, and when the nib is loaded, the instances is reconstituted from the object archive, meaning that instead of init:, initWithFrame:, initWithNibName:, or initWithLarryMoeAndCurley:, it will always use initWithCoder: to initialize the object.

Try putting your code in initWithCoder:, make sure to call super first, and return self.
__________________
Check out my iPhone Dev Blog
You can send me e-mail at my forum username at mac dot com.
jeff_lamarche 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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


» Advertisements
» Stats
Members: 51,375
Threads: 52,830
Posts: 225,477
Top Poster: BrianSlick (3,576)
Welcome to our newest member, darrentousignant
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:29 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0