Skip to content

Instantly share code, notes, and snippets.

@arkilis
Last active April 13, 2017 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arkilis/c0ffe03fed39573f08161449e17dff6a to your computer and use it in GitHub Desktop.
Save arkilis/c0ffe03fed39573f08161449e17dff6a to your computer and use it in GitHub Desktop.
viewContoller_4_methods_oc
#import "ViewController.h"
@interface ViewController (){
UIViewController *anotherView;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"viewDidLoad is running");
anotherView = [UIViewController new];
anotherView.view.backgroundColor = [UIColor redColor];
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSLog(@"viewWillAppear is running");
}
-(void)viewDidAppear:(BOOL)animated{
NSLog(@"viewDidAppear is running");
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
NSLog(@"viewWillDisappear is running");
}
-(void)viewDidDisappear:(BOOL)animated{
NSLog(@"viewDidDisappear is running");
}
- (IBAction)onClickBtn:(id)sender {
[self presentViewController:anotherView animated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment