// // YMBaseViewController.h // MSYOUPAI // // Created by YoMi on 2024/2/4. // Copyright © 2024 MS. All rights reserved. // #import "ZCBaseVC.h" #import "YMBaseViewModel.h" #import "YMBaseCustomNavView.h" #import NS_ASSUME_NONNULL_BEGIN /** 导航栏风格 */ typedef NS_ENUM(NSUInteger, YMBaseNavigationStyle) { /** 白色*/ YMBaseNavigationStyleWhite = 0, /** 透明背景白色返回*/ YMBaseNavigationStyleClearBgWhiteBackArrow, /** 透明背景黑色返回*/ YMBaseNavigationStyleClearBgBlackBackArrow, /** 渐变*/ YMBaseNavigationStyleGradient, }; @interface YMBaseViewController : ZCBaseVC ///导航栏的样式 @property (nonatomic, assign) YMBaseNavigationStyle ym_navigationStyle; ///自定义导航栏 如果需要自定义导航栏在最上层,把其他视图用sendSubviewToBack降至底层这样就不会被遮罩住无法交互了 @property (nonatomic, strong) YMBaseCustomNavView *ym_customNavView; ///是否隐藏左item @property (nonatomic, assign) BOOL isHideLeftItem; ///隐藏导航条 - (void)setNavHidden:(BOOL)hidden; /** 统一使用该方法初始化,子类中直接声明对于的'readonly' 的 'viewModel'属性, 并在@implementation内部加上关键词 '@dynamic viewModel;' @dynamic A相当于告诉编译器:“参数A的getter和setter方法并不在此处, 而在其他地方实现了或者生成了,当你程序运行的时候你就知道了, 所以别警告我了”这样程序在运行的时候, 对应参数的getter和setter方法就会在其他地方去寻找,比如父类。 */ - (instancetype)initWithViewModel:(YMBaseViewModel*)viewModel; @property (nonatomic, strong, readonly) YMBaseViewModel *viewModel; - (void)ym_setupViews; - (void)ym_bindViewModel; /// 下拉刷新头部 @property (nonatomic, strong) MJRefreshNormalHeader *refreshHeader; /// 上拉加载更多底部,还有更多数据可以加载的状态下使用 @property (nonatomic, strong) MJRefreshAutoNormalFooter *loadMoreFooter; /// 不会上拉加载更多的底部,没有更多数据可以加载的状态下使用 @property (nonatomic, strong) MJRefreshAutoNormalFooter *noLoadMoreFooter; /// 下拉刷新回调方法,具体实现代码需要子类实现 - (void)headerRefreshing; /// 上拉加载回调方法,具体实现代码需要子类实现 - (void)footerRefreshing; @end /** 导航按钮*/ @interface YMBaseViewController (YMNavBar) /** 左Bar按钮+标题*/ - (void)setLeftBarButtonWithTitle:(NSString *)title block:(void (^)(id sender))block; /** 右Bar按钮+标题*/ - (void)setRightBarButtonWithTitle:(NSString *)title block:(void (^)(id sender))block; /** 左Bar按钮+图片*/ - (void)setLeftBarButtonWithImage:(NSString *)image block:(void (^)(id sender))block; /** 右Bar按钮+图片*/ - (void)setRightBarButtonWithImage:(NSString *)image block:(void (^)(id sender))block; /** 左Bar多个按钮*/ - (void)setLeftBarButtonWithButtons:(NSArray *)buttons; /** 右Bar多个按钮*/ - (void)setRightBarButtonWithButtons:(NSArray *)buttons; /** 左Bar自定义View*/ - (void)setLeftBarButtonWithCustomView:(UIView *)customView; /** 右Bar自定义View*/ - (void)setRightBarButtonWithCustomView:(UIView *)customView; @end NS_ASSUME_NONNULL_END