Reputation: 44285
What's does it mean to declare IBOutlet in @interface
vs not? In a simple test, the assignment works in either case.
@interface MyViewController : UIViewController <UITextFieldDelegate> {
IBOutlet UITextField *textField;
IBOutlet UILabel *label;
NSString *string;
/*IBOutlet*/ UILabel *total;//What does it mean to declare IBOutlet here?
}
@property (nonatomic, retain) IBOutlet UILabel *total;
.h
@synthesize total;
total.text = @"23";
Upvotes: 1
Views: 821
Reputation: 33428
The term IBOutlet
is only a placeholder for Xcode. By means of it, Xcode helps you to connect an instance variable to a graphical element.
Here my previous old answer for it: iOS Memory Management Issue.
Take a look. It covers a lot of stuff.
I also suggest to read nib-memory-management by Mike Ash.
Hope that helps.
Upvotes: 3
Reputation: 25318
There is no difference for IB, however, with your property in place, your UILabel
gets retained and you must release it (if you aren't using ARC). If you don't use the @property
, the label isn't owned by you and you don't need to release it.
Upvotes: 2
Reputation: 18551
It means that the ivar will be an IBOutlet. Just like your current property is an IBOutlet.
You're making a bigger mistake in naming your ivar and property the same thing.
total.text
and self.total.text
in your file are not the same thing.
Upvotes: 2