Create a view controller base class that extends UIViewController
. Then make sure all of your view controllers extend this base class. Do the same for UITableViewController
if needed.
In these base classes you can implement the two methods and add your deprecation flag to the method declarations in the .h file.
TGViewController.h
@interface TGViewController : UIViewConrtoller
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion NS_DEPRECATED_IOS(5_0, 6_0);
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion NS_DEPRECATED_IOS(5_0, 6_0);
@end
TGViewController.m
@implementation TGViewController
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion {
[super presentViewController:viewControllerToPresent animated:flag completion:completion];
}
- (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion {
[super dismissControllerAnimated:flag completion:completion];
}
@end
No pragmas needed.
You can also use these base classes to add any other app-level features you might want.