ios - 如何在 TabBar 中删除和重置顶行 - 适用于 iOS 13+
问题描述
我正在尝试在 iOS 13.2.2 中删除 TabBar 中的顶行,但对于 iOS 13.2.2,以下帖子中的这些答案都不再适用
链接 -从 TabBar 中删除顶行
最近有 API 变化吗?
如何在 iOS 13.2.2 中删除和重置 TabBar 的顶行?
解决方案
如果您编写自己的 TabBar 类以确保您可以进行所有您想要的更改,那总是会更好。
#import "ViewController.h"
@protocol TabBarDelegate;
@interface TabBar : UIView{
id<TabBarDelegate> delegate;
UIView *backgroundView;
UIButton *btn1;
UIButton *btn2;
UIImageView *img1;
UIImageView *img2;
UIView *hubHolder;
}
@property (nonatomic, retain) UIView *backgroundView;
@property (nonatomic, retain) id<TabBarDelegate> delegate;
@property (nonatomic, retain) UIButton *btn1;
@property (nonatomic, retain) UIButton *btn2;
@property (nonatomic, retain) UIImageView *img1;
@property (nonatomic, retain) UIImageView *img2;
- (id) initWithFrame:(CGRect)frame;
@end
@protocol TabBarDelegate<NSObject>
@optional
- (void) tabbarTapped:(int)index;
@end
您可以轻松地定义一个带有按钮的视图(按钮编号取决于您想通过标签栏访问多少个控制器)并委托控制是否点击了其中一个按钮。由于这是一个 UIView,您可以操纵它的外观。我希望它有所帮助。
推荐阅读
- android - SVG 文件在 Android Studio 中是否可扩展
- python - 如何在不使用字符串方法的情况下反转数字?
- excel - 列范围可以与 SUBSTITUTE 一起使用吗
- python - 如何使用 PyCharm 激活我的虚拟环境?我什至可以在 PyCharm 中激活它吗?
- gridsome - 单击按钮后调用 API
- javascript - 如何添加 4 位小数的输出结果?
- flutter - 带有不匹配参数的闭包调用:函数'LoginScreen.build。
- bash - 如何使用现有文件夹名称作为基本名称创建按顺序编号的文件夹列表
- python - django:如何从 View.py 读取和操作 .csv 文件
- flutter - 如何在 ListView 中显示来自实时数据库的数据?