123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // ZCBaseVC.m
- // HuaKaiChat
- //
- // Created by 张灿 on 2017/6/27.
- // Copyright © 2017年 huakai. All rights reserved.
- //
- #import "ZCBaseVC.h"
- @interface ZCBaseVC ()
- @property (nonatomic,strong)UILabel *label;
- @end
- @implementation ZCBaseVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.view.backgroundColor = LZFAFAFCColor;
- //从屏幕左上角作为(0.0)不包括导航栏的高度
- self.automaticallyAdjustsScrollViewInsets = NO;
- self.extendedLayoutIncludesOpaqueBars = YES;
-
- if (@available(iOS 11.0, *)) {
- UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- }else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
-
- // 禁用返回手势
- if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
- self.navigationController.interactivePopGestureRecognizer.enabled = NO;
- }
- self.sx_disableInteractivePop = NO;
-
-
-
- }
- -(void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [UMengRecordTool umengEnterViewWithName:NSStringFromClass(self.class)];
- }
- - (void)viewDidDisappear:(BOOL)animated {
- [super viewDidDisappear:animated];
- [UMengRecordTool umengOutViewWithName:NSStringFromClass(self.class)];
- #ifdef DEBUG
- NSLog(@"*******ViewController did Disappear = %@", NSStringFromClass([self class]));
- #endif
- }
- - (void)viewDidAppear:(BOOL)animated{
- [super viewDidAppear:animated];
- #ifdef DEBUG
- NSLog(@"*******ViewController did appear = %@", NSStringFromClass([self class]));
- #endif
- }
- - (void)dealloc {
- #ifdef DEBUG
- NSLog(@"*******ViewController dealloc = %@", NSStringFromClass([self class]));
- #endif
-
- [OCNotificationCenter removeObserver:self];
- }
- -(BOOL)prefersStatusBarHidden
- {
- return NO;
- }
- - (UIStatusBarStyle)preferredStatusBarStyle{
- return UIStatusBarStyleDefault;
- }
- - (void)pushEffectPresentToVC:(UIViewController*)vc{
- CATransition *transition = [CATransition animation];
- transition.duration = 0.4;
- transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
- transition.type = kCATransitionPush;
- transition.subtype = kCATransitionFromTop;
- [self.navigationController.view.layer addAnimation:transition forKey:nil];
- [self.navigationController pushViewController:vc animated:NO ];
- }
- - (void)popEffectDismiss{
- CATransition *transition = [CATransition animation];
- transition.duration = 0.4;
- transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
- transition.type = kCATransitionPush;
- transition.subtype = kCATransitionFromBottom;
- [self.navigationController.view.layer addAnimation:transition forKey:nil];
- [self.navigationController popViewControllerAnimated:NO];
- }
- - (void)popEffectDismissWithIndex:(NSInteger)index{
- CATransition *transition = [CATransition animation];
- transition.duration = 0.4;
- transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
- transition.type = kCATransitionPush;
- transition.subtype = kCATransitionFromBottom;
- [self.navigationController.view.layer addAnimation:transition forKey:nil];
- self.navigationController.navigationBarHidden = NO;
- [self.navigationController popToViewController:self.navigationController.childViewControllers[index] animated:NO];
- }
- @end
|