登录 立即注册
金钱:

JDJellyButton

来自: Torr 分类: iOS精品源码 上传时间: 2017-1-3 10:32:59
Tag:button 按钮 自定义 按钮组 UIButton

项目介绍:

JDJellyButton

https://github.com/jamesdouble/JDJellyButton


Introduction

Jelly Button是一个高度定制的导航按钮。

您可以管理自己的按钮组。

当按钮被实现代理点击时,你可以收到通知。

Alt text


Switch Button Group

To Switch Button Group, you just need to hold on Mainbutton for 1.5 second.

Alt text

Usage

To add JellyButton to your view, you need to designate the attached view and the Main button image.

button = JDJellyButton()
button.attachtoView(rootView: self.view,mainbutton: UIImage(named:"vk")!)
button.delegate = self  //Optional
button.datasource = self

Important

Also you need to implements the protocol JDJellyButtonDataSource ,designating your button group count and image array in specific group.

let images:[UIImage] = [UIImage(named: "badoo")!,UIImage(named: "behance")!,UIImage(named: "deviantart")!]
let images2:[UIImage] = [UIImage(named: "dribbble")!,UIImage(named: "facebook")!,UIImage(named: "flickr")!]
let images3:[UIImage] = [UIImage(named: "google-plus")!,UIImage(named: "instagram")!,UIImage(named:"lastfm")!,UIImage(named: "linkedin")!]
var imagearr:[[UIImage]] = [[UIImage]]()

extension ViewController:JDJellyButtonDataSource
{
    func groupcount()->Int
    {
    return 3
    }
    func imagesource(forgroup groupindex:Int) -> [UIImage]
    {
    return imagearr[groupindex]
    }
}

Change Expanding Type

There're some button expanding type you can choose.

/*
enum JellyButtonExpandType
{
    case Cross
    case LeftLine
    case RightLine
    case UpperLine
}
*/
button.setJellyType(type: .Cross)

Alt text

Delegate(Optional))

If you want to get notification when user tap one of buttons, you can implement JellyButtonDelegate

extension ViewController:JellyButtonDelegate
{
    func JellyButtonHasBeenTap(touch:UITouch,image:UIImage,groupindex:Int,arrindex:Int)
    {
        self.exampleimg.image = image
        label1.text = "Group Index:\(groupindex)"
        label2.text = "ArrIndex\(arrindex)"
    }
    
}

Alt text

code4app

相关源码推荐:

我来说两句
*滑动验证:
所有评论(28)
littleRed 2017-1-3 15:45:52
相当不错,感谢无私分享精神!
回复
hellokenken 2017-1-3 15:46:49
虽不明,但觉厉...
回复
kengsir 2017-1-3 15:48:27
感谢大神分享,必须顶!
回复
BlueManlove 2017-1-3 15:50:00
好好 学习了 确实不错
回复
AlonMessi 2017-1-3 15:55:09
学习...学习...
回复
phoiu 2017-1-3 15:57:41
小弟学习了~支持,支持
回复
code4app热心网友 2017-1-3 17:04:02
淡定,淡定,淡定……
回复
lvxiang 2017-1-4 12:27:18
感谢分享,Code4App有你更精彩
回复
wufer 2017-1-4 13:46:55
很给力,Code4App有你更精彩!
回复
123下一页
提取码:  下载次数:18 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
234 0 18
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

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

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

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