SHNDStuffs 2.0.1

SHNDStuffs 2.0.1

Sahand RS 维护。



SHNDStuffs

CI Status swift-version Version License Platform

示例

要运行示例项目,首先克隆仓库,然后在示例目录中运行 pod install

UINavigationBar 渐变背景

要在 viewDidLoad() 中设置 UINavigationBar 的渐变背景和 tintColor,可以使用以下函数:

override func viewDidLoad() {
    super.viewDidLoad()
        
    SHNDNavigationBarGradient(firstColor: .darkGray,
                              secondColor: .white,
                              tintColor: .black,
                              isHorizontal: true)
}

example 0 , example 3, example 4

SHNDNavigationCustomTitleView

要设置 UINavigationBarItem 的自定义标题视图,请在 viewDidLoad() 中使用以下构建器模式。

override func viewDidLoad() {
    super.viewDidLoad()
    let navTitleBuilder = NavigationTitleViewBuilder(title: "SHNDStuffs",
                                                     desc: "Custom Title View",
                                                     titleFont: UIFont(name: "Papyrus", size: 18)!,
                                                     descFont: UIFont(name: "Kailasa", size: 10)!,
                                                     titleTextColor: .purple,
                                                     descTextColor: .black)
    SHNDNavigationCustomTitleView(builder: navTitleBuilder)                                                     
}

shndnavcustomtitleview

很简单,对吧?!😋😋

SHNDButton 点击后动画

如果在按钮被点击后你想获得一个动画(晃动、脉冲或闪烁)

@IBAction func buttonPressed(_ sender: SHNDButton) {

    let animationElements = AnimationElements(duration: 0.1,
                                              repeatCount: 3,
                                              autoreverses: true,
                                              animationMode: .shake)
    sender.SHNDButtonAnimation(animationElements: animationElements)
}

SHNDShimmerLabel

Shimmer ,Shimmer ,Shimmer😄简单又惊人,就像它应该的那样😉:

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    
    let builderObject = ShimmerObject.init(text: "shndRS",
                                           font: UIFont(name: "Papyrus", size: 73)!,
                                           textAlignment: .center, animationDuration: 2,
                                           frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 400),
                                           parentView: view,
                                           mainLabelTextColor: .orange,
                                           maskLabelTextColor: .purple)

    SHNDShimmerFactory.create(builder: builderObject)
}

这就是它的样子

shndshimmer

SHNDView, SHNDButton, SHNDImageView, SHNDTextField

要使用SHNDView, SHNDButton, SHNDImageView,只需将其中的任意一个类放入你对象的子类中,就设置好了……现在你的NavigationInspector就有了一些令人惊叹的功能

shndviewimage

SHNDDynamicGradientView

你是否曾见过Instagram登录/注册页面的动态渐变视图?好消息是,在SHNDStuffs中,我为你准备了一些东西,你可以在你的应用中实现这个动画,它相当简单

let object = SHNDDynamicGradientViewObject.init(colorArray: colorArray,
                                                duration: 8,
                                                shndView: gradientView)

SHNDDynamicGradientView(builder: object).animate()

ps: colorArray是一个类似于这样的UIColor元组的数组

var colorArray:[(firstColor:UIColor, secondColor:UIColor)] = []

添加你想要的任何颜色到其中

colorArray.append((firstColor: .purple, secondColor: .gray))
colorArray.append((firstColor: .red, secondColor: .blue))
colorArray.append((firstColor: .orange, secondColor: .brown))

现在你就有它了😉

要求

iOS 9.0+

Xcode 10.0

Swift 4.0及以上

安装

SHNDStuffs可以通过CocoaPods获取。要安装它,只需将以下行添加到你的Podfile中

pod 'SHNDStuffs'

作者

[email protected][email protected]

许可证

SHNDStuffs遵循MIT许可证。请参阅LICENSE文件了解更多信息。