Latest 0.0.4
Homepage https://github.com/pujiaxin33/JXGradientKit
License MIT
Platforms ios 9.0, requires ARC
Frameworks UIKit
Authors

预览

list

原理

重载UIView的layerClass方法,返回CAGradientLayer,达到控件背景为渐变色。

控件种类

  • JXGradientLabel
  • JXGradientView
  • JXGradientButton
  • JXGradientTextField
  • JXGradientTextView

使用

XIB可视化编辑

XIB

代码使用

使用JXGradientViewProtocol协议约定的便利属性

gradientView.direction = JXGradientLayerDirection.leftToRight.rawValue
gradientView.startColor = firstColor
gradientView.endColor = secondColor

直接配置CAGradientLayer

gradientView.gradientLayer.jx_direction = .leftToRight
gradientView.gradientLayer.colors = [firstColor, secondColor]

安装

CocoaPods

use_frameworks!
target '<Your Target Name>' do
    pod 'JXGradientKit'
end

Latest podspec

{
    "name": "JXGradientKit",
    "version": "0.0.4",
    "summary": "u5e38u7528u63a7u4ef6u80ccu666fu6e10u53d8u8272Kit",
    "homepage": "https://github.com/pujiaxin33/JXGradientKit",
    "license": "MIT",
    "authors": {
        "pujiaxin33": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.2",
    "source": {
        "git": "https://github.com/pujiaxin33/JXGradientKit.git",
        "tag": "0.0.4"
    },
    "frameworks": "UIKit",
    "source_files": [
        "Sources",
        "Sources/*.{swift}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This