繁体   English   中英

如何删除和重置 TabBar 中的顶行 - 适用于 iOS 13+

[英]How to remove and reset top line in TabBar - For iOS 13+

我正在尝试删除 iOS 13.2.2 中 TabBar 中的顶行,但下面这些答案都不再适用于 iOS 13.2.2

链接 - 从 TabBar 中删除顶行

  1. 最近有任何 API 变化吗?

  2. 如何在 iOS 13.2.2 的 TabBar 中删除和重置顶行?

尝试这个:

self.tabBarController!.tabBar.layer.borderWidth = 0.50
self.tabBarController!.tabBar.layer.borderColor = UIColor.clearColor().CGColor
self.tabBarController?.tabBar.clipsToBounds = true

如果您编写自己的 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,您可以操纵它的外观。 我希望它有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM