【问题标题】:How to remove and reset top line in TabBar - For iOS 13+如何在 TabBar 中删除和重置顶行 - 适用于 iOS 13+
【发布时间】:2019-11-29 10:29:32
【问题描述】:

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

链接 - Remove top line from TabBar

  1. 最近是否有任何 API 更改?

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

【问题讨论】:

标签: ios objective-c swift uitabbar


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2017-02-12
    • 2017-04-13
    • 1970-01-01
    • 2020-02-18
    • 2013-09-27
    • 1970-01-01
    • 1970-01-01
    • 2020-02-04
    • 1970-01-01
    相关资源
    最近更新 更多