RE: Accessing IB objects
RE: Accessing IB objects
- Subject: RE: Accessing IB objects
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Tue, 11 Mar 2003 13:54:23 -0500
>
However,
>
I can't figure out how to access an IB object that hasn't been explicitly
>
linked to an action or outlet. I haven't found any docs on the subject.
It is far more convenient to use outlets if you have a small number of
objects. With a lot of objects you need a different strategy.
If you have a lot of similar objects and you don't want to make outlets for
all of them, you might be able to use a matrix. You can have a matrix of
text fields, and connect one outlet to the matrix as a whole. Then you can
access any of the text fields by referring to the field's tag or by
accessing the array of cells in the matrix. Check NSMatrix.
Cocoa also has methods for getting a view's superview and subviews. To get
all the subviews in a view containing fieldOne, you can do NSArray
*theSubviews = [[fieldOne superview] subviews]. You can then iterate
through theSubviews testing for the object you are looking for. Some views
also let you set an integer tag in IB and access it programmatically. Check
NSView.
Jonathan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.