Chapter 8 UITableView and UITableViewController
Chapter 8 UITableView and UITableViewController
1. The designated initializer of UITableViewController is initWithStyle:, which takes a constant that determines the style of the table view. There are two options: UITableViewStylePlain and UITableViewStyleGrouped. These looked quite different on iOS6, but the differences are quite minor as of iOS7.
2. A static variable is not destroyed when the method is done executing. Like a global variable, it is not kept on the stack. Static variable can be used singleton pattern.
+(instancetype)sharedStore
{
static BNRItemStore *sharedStore = nil;
if(!sharedStore)
{
sharedStore = [[self alloc] initPrivate];
}
return sharedStore;
}
-(instancetype)initPrivate
{
self = [super init];
return self;
}
3. Using the @class directive can speed up compile times considerably because fewer files have to be recompiled when one file changes.
4. To reuse UITableViewCell, the UITableViewCell should be registered to the table view firstly.