dkahgld

UIViewController+WBSliderViewController.m 891B

123456789101112131415161718192021222324252627282930
  1. //
  2. // UIViewController+WBSliderViewController.m
  3. // WBSliderViewController
  4. //
  5. // Created by WB on 16/11/14.
  6. // Copyright © 2016年 WB. All rights reserved.
  7. //
  8. #import "UIViewController+WBSliderViewController.h"
  9. #import "WBSliderViewController.h"
  10. @implementation UIViewController (WBSliderViewController)
  11. - (WBSliderViewController *)sliderViewController
  12. {
  13. UIViewController *viewcontroller = (UIViewController *)self.parentViewController;
  14. while (viewcontroller) {
  15. if ([viewcontroller isKindOfClass:[WBSliderViewController class]]) {
  16. return (WBSliderViewController *)viewcontroller;
  17. }else if (viewcontroller.parentViewController && viewcontroller.parentViewController!=viewcontroller){
  18. viewcontroller = (UIViewController *)viewcontroller.parentViewController;
  19. }else{
  20. return nil;
  21. }
  22. }
  23. return nil;
  24. }
  25. @end