+ (id)buttonWithType:(UIButtonType)buttonType is a class method that handles the allocation and initialization of a UIButton for you (note the + sign in front of the return value). It returns an autoreleased object. Many classes have convenience methods for creating members of the class: e.g. [NSDictionary dictionary], [NSString stringWithFormat:â¦] etc
In many cases this simplifies (less typing, easier memory management) the creation of a new object. With UIButton it is the only way, outside of Interface Builder, to create a button.
Bob
|