CustomTabbarView.h 889 B

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // CustomTabbarView.h
  3. // BuguLive
  4. //
  5. // Created by qitewei on 2025/8/27.
  6. // Copyright © 2025 xfg. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @class CustomTabbarView;
  11. @protocol CustomTabbarViewDelegate <NSObject>
  12. @optional
  13. - (void)customTabbarView:(CustomTabbarView *)tabbarView didSelectItemAtIndex:(NSInteger)index;
  14. @end
  15. @interface CustomTabbarView : UIView
  16. @property (nonatomic, strong) UIStackView *stackView;
  17. @property (nonatomic, weak) id<CustomTabbarViewDelegate> delegate;
  18. @property (nonatomic, assign) NSInteger selectedIndex;
  19. // 添加TabBar项
  20. - (void)addTabBarItemWithTitle:(NSString *)title
  21. normalImage:(NSString *)normalImage
  22. selectedImage:(NSString *)selectedImage;
  23. // 设置选中状态
  24. - (void)setSelectedIndex:(NSInteger)selectedIndex animated:(BOOL)animated;
  25. @end
  26. NS_ASSUME_NONNULL_END