Last active
September 7, 2017 14:40
-
-
Save numantariq/b64e5f697b711338119ebbdd20e78d03 to your computer and use it in GitHub Desktop.
An example base class for View Controllers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ___FILENAME___ | |
// ___PROJECTNAME___ | |
// | |
// Created by ___FULLUSERNAME___ on ___DATE___. | |
//___COPYRIGHT___ | |
// | |
#import <UIKit/UIKit.h> | |
@interface BaseViewController : UIViewController | |
- (void)commonInitializer; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ___FILENAME___ | |
// ___PROJECTNAME___ | |
// | |
// Created by ___FULLUSERNAME___ on ___DATE___. | |
//___COPYRIGHT___ | |
// | |
#import "BaseViewController.h" | |
@interface BaseViewController () | |
@end | |
@implementation BaseViewController | |
#pragma mark - Initializer | |
- (instancetype)init { | |
self = [super init]; | |
if (self) { | |
[self commonInitializer]; | |
} | |
return self; | |
} | |
- (void)commonInitializer { | |
// Overwrite in subclasses | |
} | |
#pragma mark - Lifecycle Events | |
- (void)viewWillDisappear:(BOOL)animated { | |
[super viewWillDisappear:animated]; | |
[[NSNotificationCenter defaultCenter] removeObserver:self]; | |
} | |
#pragma mark - Navigation & Status Bar | |
- (UIStatusBarStyle)preferredStatusBarStyle { | |
return UIStatusBarStyleLightContent; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment