I used IB to created some UIView
objects and used IBOutlet
to link to my code.
1. IBOutlet UIView *view1;
2. IBOutlet UIView *view1; @property(retain) UIView *view1;
3. UIView *view1 ; @prop开发者_如何转开发erty(retain) IBOutlet UIView *view1;
what's the difference ? should I release
them manually ?
You should remove it manually....
your third statement would work correctly... as Xcode identifies nib controls from its property declaration and not from inside class declaration.
(in side class)
IBOutlet UIView *view1;
Interface builder probably won't recognize it as IBoutlet as it is declared only inside the class. (class variable are protected)
IBOutlet UIView *view1; @property(retain) UIView *view1;
Interface builder probably won't recognize it as IBoutlet as it is declared only inside the class. (class variable are protected)
3. UIView *view1 ; @property(retain) IBOutlet UIView *view1;
correct way Interface builder will recognize it. and it will show it when you connect referencing outlet from your Interface builder
Please visit here .
You need to release manually all of the IBOutlets in
dealloc
and set it nil in unload
.
Hi you can release them in dealloc method manually.
- (void)dealloc {
[view1 release];
[view2 release];
[super dealloc];
}
精彩评论