How do you use the Object type in interface builder?
In interface builder there is available type of object called "Object".
I have tried to use this to wire up a view with a property pointing to one of these objects. I have set the class on Object in interface builder to a custom class. I don't need to set any other properties on this custom class. Basically my desired behaviour is that if that property is set then the view will call a method on it during its lifecycle.
When the view is inflated from the nib file however,开发者_如何学C my property on the view remains nil.
Is what I am trying to do possible?
I think that:
- if you added your custom object in Interface Builder like shown on this video; AND
- if you connected it to a properly defined property in your view controller (e.g.
@property (nonatomic, retain) IBOutlet MyClass *anObj;
and synthesized it in *.m file; AND - if you didn't override
+alloc
and-init
of your custom class in a strange way (IB objects get instantiated via alloc and init calls AFAIK - someone please correct me if I'm wrong)
your object should not be nil
after the nib file was unarchived in runtime. If I meet above conditions for my objects in IB, they are not nil
.
精彩评论