statusText is a UILabel in your code example
- Is it an
IBOutlet or a UILabel?
Both.
UILabel is a type (a pointer to UILabel component that you use in GUI)
IBOutlet marks variable for Interface Builder application, so that it knows to show it as Outlet. During compilation IBOutlet is compiled out, it is defined in NSNibDeclarations.h as:
#define IBOutlet
- How does
@property
(retain,nonatomic) UILabel
*statusText work?
You can create accessors (getters/setters) for a variable by hand, no need to use property. You can just have UILabel *statusText and implement your getter/setters by hand.
You can have accessors declared by compiler by defining variable as a @property and then either use @synthesize to create accessors in .m file or again you declare the accessors yourself (you can override default accessors that would be generated)
You can have readwrite or readonly property - meaning either both setter and getter gets generated or only getter.
You can use copy, retain or assign for setter (see more about memory management about the tree optons copy/retain/assign)
There are some other options like nonatomic/atomic which has to do with generating mutexes and lock variable before access and so on (see more about properties)
For example if you have variable
NSString * string;
defining it as readwrite property and then synthesising you get the compiler to generate for you:
@property (copy, readwrite) NSString * string
then using
@synthesize string;
generates something like:
- (NSString *) string
{
return string;
}
- (void)setString:(NSString *)str
{
NSString * copy = [str copy];
[string release];
string = copy;
}
- Does that statement mean that
statusText is a property???
Yes you defined it as a property as explained above.
There are couple of concepts involved here.
Definition of variable, defining it as IBOutlet for Interface Builder, declare variables as properties so that compiler generates getters/setters for you, defining type of getters/setters such as access method, memory management and locking.
I hope this explains your questions and if you follow the link you will find the explanation by Apple which I believe is quite clear about how to use properties.
Sorry for the horrible formatting ...