登录 立即注册
金钱:

Code4App-iOS开发-iOS 开源代码库-iOS代码实例搜索-iOS特效示例-iOS代码例子下载-Code4App.com

Swift RHSideButtons

[复制链接]
来自: 李世铿 分类: iOS精品源码 上传时间: 2016-7-12 15:30:01
Tag:builder pressed change button animation

项目介绍:

使用方法如下:
需要实现 RHSideButtonsDataSource and RHSideButtonsDelegate 数据源和代理方法

[Objective-C] 查看源文件 复制代码
// You need to firstly create trigger button. You can do this using block or your builder object which should conform to 'RHButtonViewConfigProtocol'
// RHTriggerButtonView allows you to change image for pressed state! 
let triggerButton = RHTriggerButtonView(pressedImage: UIImage(named: "exit_icon")!) {
    $0.image = UIImage(named: "trigger_img")
    $0.hasShadow = true
}

// Then you need to create instance of SideButtons coordinator class with your View Controller view (it can be even TableView)
sideButtonsView = RHSideButtons(parentView: view, triggerButton: triggerButton)
sideButtonsView.delegate = self
sideButtonsView.dataSource = self

// When SideButtons controller is initialized properly you should set thier position in view in e.g. viewDidLoad method:
override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)

    sideBttns?.setTriggerButtonPosition(CGPoint(x: bounds.width - 85, y: frame.size.height - 85))
    sideButtonsView.reloadButtons()
}
//Finally you should create array of button which will feed our dataSource and Delegate methods :) e.g.:
let button_1 = RHButtonView {
    $0.image = UIImage(named: "icon_1")
    $0.hasShadow = true
}

let button_2 = RHButtonView {
    $0.image = UIImage(named: "icon_2")
    $0.hasShadow = true
}

let button_3 = RHButtonView {
    $0.image = UIImage(named: "icon_3")
    $0.hasShadow = true
}

buttonsArr.appendContentsOf([button_1, button_2, button_3])

//As it is in tableView, now you should reload buttons with new values
sideButtonsView.reloadButtons()
RHSideButtonsDataSource

func sideButtonsNumberOfButtons(sideButtons: RHSideButtons) -> Int
func sideButtons(sideButtons: RHSideButtons, buttonAtIndex index: Int) -> RHButtonView
RHSideButtonsDelegate

func sideButtons(sideButtons: RHSideButtons, didSelectButtonAtIndex index: Int)
func sideButtons(sideButtons: RHSideButtons, didTriggerButtonChangeStateTo state: RHButtonState)


DEMO 直接下载:

相关源码推荐:

我来说两句
*滑动验证:
所有评论(31)
dachuzi 2016-7-12 16:38:02
感谢分享,Code4App有你更精彩
回复
1339368691 2016-7-13 10:10:08
我只是路过打酱油的。
回复
Code阳 2016-7-13 12:45:49
淡定,淡定,淡定……
回复
liuwenl 2016-7-14 16:40:00
精华内容,楼主V5!
回复
liuhaiyangqwer 2016-7-18 17:41:58
强烈支持楼主ing……
回复
shizhongjunzi 2016-7-18 22:42:00
我只是路过打酱油的。
回复
2713568277 2016-7-20 11:13:33
我只是路过打酱油的。
回复
NO_不知道 2016-7-22 00:17:26
淡定,淡定,淡定……
回复
NO_不知道 2016-7-22 01:41:23
精华内容,楼主V5!
回复
1234下一页
提取码:  下载次数:51 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
1013 0 51
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

代码贡献英雄榜
用户名 下载数
通过邮件订阅最新 Code4App 信息
上一条 /4 下一条
联系我们
关闭
合作电话:
13802416937
Email:
435399051@qq.com
商务市场合作/投稿
问题反馈及帮助
联系我们

广告投放| Github|申请友链|手机版|Code4App ( 粤ICP备15117877号-1 )

快速回复 返回顶部 返回列表