#import "HPFSecondViewController.h"
@interface HPFSecondViewController ()
@end
@implementation HPFSecondViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
//判断有没有可视化(nib或xib),有的话从xib中初始化
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
//不要在init中调用试图控制器的view
// Custom initialization
NSLog(@"init");
}
return self;
}
-(void)loadView{
//加载视图控制器的view
//如果没有创建self.view的话 会和viewdidload循环几次 但当viewdidload中调用self.view的话 就会无线循环
[super loadView];
//相当于可视化中的创建界面,如用到可视化编程 不建议使用loadview方法,这里创建的视图回将可视化中的视图覆盖
NSLog(@"%s",__func__);
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view .backgroundColor = [UIColor whiteColor];
// self.view.frame 是虚的不是最终的一个值,在viewdidload重作调整,看是否有导航条状态条等 是否透明等
//在viewdidload要对self.view的第一个子视图做判断 如果是滚动视图要自动作调整
}
-(void)viewWillAppear:(BOOL)animated{
NSLog(@"%s",__func__);
[super viewWillAppear:YES];
}
-(void)viewDidAppear:(BOOL)animated{
NSLog(@"%s",__func__);
[super viewDidDisappear:YES];
}
-(void)viewWillDisappear:(BOOL)animated{
NSLog(@"%s",__func__);
[super viewDidDisappear:YES];
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:YES];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}