// // UIViewController+General.h // AIIM // // Created by qitewei on 2025/5/5. // #import NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, BarButtonItemPosition) { BarButtonItemPositionLeft, BarButtonItemPositionRight }; @interface UIViewController (General) #pragma mark - Navigation Bar 基本配置 /// 设置导航栏是否隐藏 (默认NO) - (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated; /// 设置导航栏是否透明 (默认NO) - (void)setNavigationBarTransparent:(BOOL)transparent; /// 设置导航栏背景颜色 (默认白色) - (void)setNavigationBarBackgroundColor:(UIColor *)color; /// 设置导航栏标题 - (void)setNavigationTitle:(NSString *)title; /// 设置导航栏标题颜色和字体 - (void)setNavigationTitleColor:(UIColor *)color font:(UIFont *)font; #pragma mark - 返回按钮配置 /// 设置返回按钮文字 (默认"返回") - (void)setBackButtonTitle:(NSString *)title; /// 设置返回按钮图片 (默认系统返回箭头) - (void)setBackButtonImage:(UIImage *)image; /// 设置返回按钮颜色 (默认蓝色) - (void)setBackButtonColor:(UIColor *)color; /// 禁用返回手势 (默认NO) - (void)disableInteractivePopGesture:(BOOL)disable; #pragma mark - 添加自定义按钮 /// 添加文字按钮 - (void)addBarButtonWithTitle:(NSString *)title position:(BarButtonItemPosition)position action:(SEL)action; /// 添加图片按钮 - (void)addBarButtonWithImage:(UIImage *)image position:(BarButtonItemPosition)position action:(SEL)action; /// 添加自定义视图按钮 - (void)addBarButtonWithCustomView:(UIView *)view position:(BarButtonItemPosition)position; /// 移除指定位置的按钮 - (void)removeBarButtonAtPosition:(BarButtonItemPosition)position; #pragma mark - 工具方法 /// 返回上一级页面 - (void)popViewController; /// 返回根视图 - (void)popToRootViewController; @end NS_ASSUME_NONNULL_END