#pragma mark 模版提高的办法/** 初始化办法
运用代码创建cell的时分会被调用;若运用xib或许storyBoard创建cell控件的话,此办法不会被调用
*/
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];//承继父类信息if (self) {
//设置特性信息
}
returnself;
}
/**
Prepares the receiver for service after it has been loaded from an Interface Builder archive, or nib file.
xib文件每次被加载之后,会调用此办法;若运用纯代码创建cell控件的时分,不会调用此办法
*/
- (void)awakeFromNib {
// Initialization code
}
/**
Sets the selected state of the cell, optionally animating the transition between states.
1.cell控件被选中或许取消选中的时分,都会调用此办法
2.假如是自界说cell,则cell的子控件都应该添加到contentView中
*/
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected stateif (selected) {
[self.contentView setBackgroundColor:[UIColor lightGrayColor]];
}else{
[self.contentView setBackgroundColor:[UIColor whiteColor]];
}
}
The system loads the launch screen file before launching the app which creates some constraints on what it can contain (some of which may force you back to static image files):
The app is not yet loaded so the view hierarchy does not exist and the system can not call any custom view controller setup code you may have in the app (e.g. viewDidLoad)
You can only use standard UIKit classes so you can use UIView or UIViewController but not a custom subclass. If you try to set a custom class you will get an Illegal Configuration error in Xcode.
The launch screen file can only use basic UIKit views such as UIImageView and UILabel. You cannot use a UIWebView.
If you are using a storyboard you can specify multiple view controllers but there are again some limitations. For example you can embed view controllers in a navigation or tab bar controller but more complex container classes such as UISplitViewController do not work (at least not yet).
Localizing the launch screen file does not currently seem to have any effect. The base localization is always used so you will probably want to avoid text on the launch screen.
You cannot specify different launch screen files for iPad and iPhone. This may be a problem if you have significantly different interfaces for those devices as there is only so much you can do with auto layout and size classes.
// [self isMemberOfClass:]// 判别是否为本类 whether the receiver is an instance of a given class.
// [self isKindOfClass:];// 判别是否为本类 或许子类 whether the receiver is an instance of given classor an instance of anyclassthat inherits from that class.