Swift 编写的 Material design 组件(受 Google Material Design 启发)用于 iOS
请随时提交 pull request。
通过支持 @IBInspectable,类属性可以在 Interface Builder 中暴露,并且您可以实时编辑这些属性
[x] MKButton: 浮动操作按钮,提升按钮,平面按钮,水波纹效果
浮动操作按钮
、提升按钮
、平面按钮
let button = MKButton(frame: CGRect(x: 10, y: 10, width: 100, height: 35))
button.maskEnabled = true
button.rippleLocation = .TapLocation
button.rippleLayerColor = UIColor.MKColor.LightGreen
textField.rippleLocation = .Left
textField.floatingPlaceholderEnabled = true
textField.placeholder = "Description"
textField.layer.borderColor = UIColor.MKColor.Green.CGColor
textField.rippleLayerColor = UIColor.MKColor.LightGreen
var cell = tableView.dequeueReusableCellWithIdentifier("MyCell") as MyCell
cell.rippleLocation = .Center
cell.rippleLayerColor = UIColor.MKColor.Blue
var refreshControl = MKRefreshControl()
refreshControl.addToScrollView(self.tableView, withRefreshBlock: { () -> Void in
self.tableViewRefresh()
})
refreshControl.beginRefreshing()
通过调用 animateRipple
方法或设置 userInteractionEnabled = true
,您可以在需要时播放水波纹动画,当标签/图片视图被点击时,会播放水波纹动画
通过使用 MKLabel 或 MKImageView,便于自定义 UIBarButtonItem 或 UITabBarButton
// customize UIBarButtonItem by using MKImageView
let imgView = MKImageView(frame: CGRect(x: 0, y: 0, width: 44, height: 32))
imgView.image = UIImage(named: "uibaritem_icon.png")
imgView.rippleLocation = .Center
imgView.userInteractionEnabled = true
let rightBarButton = UIBarButtonItem(customView: imgView)
self.navigationItem.rightBarButtonItem = rightBarButton
CALayer 的子类。
一个用于UIColor的类别,增加了获取由Google设计的平面色值的几个方法
// get color from UIColor
let lightBlueColor = UIColor.MKColor.LightBlue
一个自定义的UINavigationBar,支持提升效果和在自身上方添加色调
开关切换单个设置选项的状态。开关控制的选项及其状态应从相应的行内标签中清晰可见。开关具有与单选按钮相同的视觉属性。
pod 'MaterialKit', :git => 'https://github.com/rahuliyer95/MaterialKit.git'
MaterialKit在MIT许可下发布。有关详细信息,请参阅LICENSE。