In my 开发者_高级运维nib file I have several controls that I placed with xcode. Is there a way I can find how many outlets there are in the nib file. since I placed all the objects in the default view of the nib file maybe I can get the child of the default view and those will be the IBOutlets. I plan on latter adding functionality to those IBOUtlets.
In short I am trying to create a connection with code.... Thats cause I have so many objects in every nib file. I am creating an app that is like a power point presentation and I have several slides..
IBOutlets arent' actually anything. That is just syntactical sugar to allow Interface Builder introspection into your code files to match up variable names.
Anyways, you can just look through all the subviews of your view in code if you need to. Not ideal, but i think this is what you are asking for.
SubclassedViewController *controller = [[SubclassedViewController alloc]
initWithNibName:@"SubclassedViewController" bundle:nil];
// actually, [[... alloc] init]; does the same
for (UIView *aView in [controller.view subviews]) {
// do stuff
}
You could identify the Views with tag
s, an integer properties that you can attach to any UIView
(also in Interface Builder).
精彩评论