口袋优选

LPBaseVC.m 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // LPBaseVC.m
  3. // LPNavPageVCTest
  4. //
  5. // Created by LPDev on 16/4/19.
  6. // Copyright © 2016年 anonymous. All rights reserved.
  7. //
  8. #import "LPBaseVC.h"
  9. @interface LPBaseVC ()
  10. @property (nonatomic, weak) UIImageView * contentLineImageView;
  11. @end
  12. @implementation LPBaseVC
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. self.contentLineImageView = [self findHairlineImageViewUnder:self.navigationController.navigationBar];
  16. }
  17. - (void)viewWillAppear:(BOOL)animated {
  18. [super viewWillAppear:animated];
  19. _contentLineImageView.hidden = YES;
  20. }
  21. - (void)viewWillDisappear:(BOOL)animated {
  22. [super viewWillDisappear:animated];
  23. _contentLineImageView.hidden = NO;
  24. }
  25. // 隐藏导航栏下面的那直线
  26. - (UIImageView *)findHairlineImageViewUnder:(UIView *)view {
  27. if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0) {
  28. return (UIImageView *)view;
  29. }
  30. for (UIView *subview in view.subviews) {
  31. UIImageView *imageView = [self findHairlineImageViewUnder:subview];
  32. if (imageView) {
  33. return imageView;
  34. }
  35. }
  36. return nil;
  37. }
  38. - (void)didReceiveMemoryWarning {
  39. [super didReceiveMemoryWarning];
  40. }
  41. /*
  42. #pragma mark - Navigation
  43. // In a storyboard-based application, you will often want to do a little preparation before navigation
  44. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  45. // Get the new view controller using [segue destinationViewController].
  46. // Pass the selected object to the new view controller.
  47. }
  48. */
  49. @end