TopTabBar-Chtar 0.0.7

TopTabBar-Chtar 0.0.7

Ragaie Alfy 维护。



  • 作者
  • Ragaie Alfy

TopTabBar-Chtar

使用原生 Swift 构建,针对 iPhone 和 iPad,主要功能让开发者能够像原生 iOS 标签栏一样进行开发。但是,您可以将它放在设计的任何位置,这里指的只是栏,而不是整个 tabBar 控制器。

使用该库的一个真实项目的结果:

您不仅仅可以从库中获得这个结果,而且您可以完全访问组件中的每个参数进行修改。

alt tag

### 入门

安装

将以下内容添加到您的 pod 文件

pod 'TopTabBar-Chtar' 
run pod update
import TopTabBar-Chtar

1- 在 Storyboard 中添加自定义视图 --> TopTabBar

2- 让项目构建并更新视图

3- 然后您将得到如下屏幕效果

以下每个参数如何更改

1- @IBInspectable var buttonNumber : Int

表示栏将提供的按钮数量,您还需要提供相同数量的字符串数组,用于提供按钮标题。

2- @IBInspectable var barBackgroundColor : UIColor

表示栏背景颜色。

3- @IBInspectable var itemBackgroundColor : UIColor

Represent button background color when it selected.

4- @IBInspectable var textColor : UIColor

Represent text default color for buttons.

5- @IBInspectable 属性 titleTint: UIColor

Represent button title text color when it is selected.

6- @IBInspectable 属性 spacing: CGFloat

Reperesnt spacing between button inside stackview.

7- @IBInspectable 属性 contentInsets: CGFloat

Represent spacing before and after button title text.

8- @IBInspectable 属性 lineColor: UIColor

Represent line bar background color.

9- @IBInspectable 属性 lineHeight: CGFloat

Reperesnt line hight.

10- @IBInspectable 属性 indicatorColor: UIColor

Represent background color of line that indicate selected item in bar.

11- 你也可以通过代码访问包含项目的 stackView 并修改项目的对齐方式,以满足您的业务需求。

12- 您还可以仅通过提供默认图像和选中图像的数组,以使栏仅通过图像工作。对于代码

提示:仍在开发中,但您可以尝试它。

获取选中索引

遵守此委托 -->

TopTabBarDelegate

并将 tabBar 输出与它一起设置

此委托包含

  func topTabBarSelected(index: Int) {
        
        print("Index \(index) had been selected")
    }

从代码选择项目

  <TopTabBarOutlet>.selectitemAt(index: 2)

您可以从中实现的一些结果

作者

您在 LinkedIn 上可以找到我