YPTabBarController.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // YPTabBarController.h
  3. // YPTabBarController
  4. //
  5. // Created by 喻平 on 15/8/11.
  6. // Copyright (c) 2015年 YPTabBarController. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "YPTabBar.h"
  10. #import "YPTabItem.h"
  11. @interface YPTabBarController : UIViewController <YPTabBarDelegate>
  12. @property (nonatomic, strong) YPTabBar *tabBar;
  13. @property (nonatomic, copy) NSArray <UIViewController *> *viewControllers;
  14. /**
  15. * 内容视图的Frame
  16. */
  17. @property (nonatomic, assign) CGRect contentViewFrame;
  18. /**
  19. * 被选中的ViewController的Index
  20. */
  21. @property (nonatomic, assign, readonly) NSInteger selectedControllerIndex;
  22. /**
  23. * 获取被选中的ViewController
  24. */
  25. - (UIViewController *)selectedController;
  26. /**
  27. * 设置内容视图支持滑动切换,以及点击item切换时是否有动画
  28. *
  29. * @param animated 点击切换时是否支持动画
  30. */
  31. - (void)setContentScrollEnabledAndTapSwitchAnimated:(BOOL)animated;
  32. @end
  33. @interface UIViewController (YPTabBarController)
  34. @property (nonatomic, copy) NSString *yp_tabItemTitle; // tabItem的标题
  35. @property (nonatomic, strong) UIImage *yp_tabItemImage; // tabItem的图像
  36. @property (nonatomic, strong) UIImage *yp_tabItemSelectedImage; // tabItem的选中图像
  37. - (YPTabItem *)yp_tabItem;
  38. - (YPTabBarController *)yp_tabBarController;
  39. /**
  40. * ViewController对应的Tab被Select后,执行此方法
  41. */
  42. - (void)tabItemDidSelected;
  43. /**
  44. * ViewController对应的Tab被Deselect后,执行此方法
  45. */
  46. - (void)tabItemDidDeselected;
  47. @end