Re: NIB doesn't link to objects
Re: NIB doesn't link to objects
- Subject: Re: NIB doesn't link to objects
- From: Andy Lee <email@hidden>
- Date: Sun, 14 Nov 2010 01:04:51 -0500
On Nov 13, 2010, at 8:50 PM, Quincey Morris wrote:
> 2. You didn't really hook up the outlets in IB. Only you can check that, and you have, but it's worth keeping in mind that it's easy to talk yourself into believing that you've done it right when you haven't. (Speaking from painful personal experience here.)
This mistake might be especially easy to make in this case if you really have similarly named outlets like tileButton1, tileButton2, etc. Also if you copy and paste objects in IB, the copies replicate some of the connections of the original, and it's easy to forget this. And if you rename outlets in your code using find and replace, the nib file won't update accordingly -- you should use refactoring instead.
Right-click your view in IB. Are there any yellow warning triangles?
> 3. You actually have 2 instances of the class, and you're seeing the misbehaving code executing in the wrong one -- the one that didn't get its outlets established -- while the one that had the correct outlets has been leaked or deallocated.
This is a common bug especially with view instances, and the one I was going to suggest next. Sometimes people's nib have a view in the view hierarchy and, because they misunderstand nibs, they also create a separate standalone instance of the view in the nib.
How many times is your view's init method being called? You can try printing self in both your init method and awakeFromNib. If you have some classes with similar names, you might want to print [self class] too, to make sure you're instantiating the class you think you are.
When "impossible" things happen in simple code, I like to check *all* my assumptions, even the ones that can't possibly be wrong.
If none of the above helps, please don't yell or be snippy with me. Remember you're the one asking for help, and we are sincerely trying to give it.
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden