• Stars
    star
    173
  • Rank 218,907 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 8 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Spring Effect To Show Button Menu.

Description

The ExpandMenuButton inspired by the prototype in dribbble(here is the link). Thanks to the prototype author - Pablo Stanley.

Screenshot

img

Usage

Initialize e.g

UIButton *btn1 = [UIButton buttonWithType: UIButtonTypeCustom];
[btn1 setImage: [UIImage imageNamed: @"cart"] forState: UIControlStateNormal];

UIButton *btn2 = [UIButton buttonWithType: UIButtonTypeCustom];
[btn2 setImage: [UIImage imageNamed: @"setting"] forState: UIControlStateNormal];

UIButton *btn3 = [UIButton buttonWithType: UIButtonTypeCustom];
[btn3 setImage: [UIImage imageNamed: @"user"] forState: UIControlStateNormal];

DGExpandMenuButton *ExpandMenuButton = [[DGExpandMenuButton alloc] initWithFrame: CGRectMake(self.view.frame.size.width / 2 - 40, 360, 80, 80) superView: self.view  andObjects: btn1, btn2, btn3, nil];

[self.view addSubview: ExpandMenuButton];

Implement

- (void)addOneButton:(UIButton *)btn;

The method can let you to add a new button freedomly and smoothly. It will check the menu status to judge whether the new button needs a animation.

e.g
- (void)viewDidLoad {
    // ...
    UIButton *plus = [UIButton buttonWithType: UIButtonTypeCustom];
    [plus setImage:[UIImage imageNamed:@"plus"] forState:UIControlStateNormal];
    plus.frame = CGRectMake(185, 200, 40, 40);
    [plus addTarget:self action:@selector(addButton) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview: plus];
}

- (void)addButton {
    UIButton *btn5 = [UIButton buttonWithType: UIButtonTypeCustom];
    btn5.backgroundColor = [UIColor grayColor];
    [_ExpandMenuButton addOneButton:btn5];
}
[_ExpandMenuButton addOneButton:btn]; img

- (void)delLastButton;

The method can let you to delete the last button in the menu, smoothly and quickly. And this interface is a internal method with gesture - Swip Down.

e.g
[_expandMenuButton delLastButton]; img

- (void)rotateAllButton;

When the menu buttons has been to the max number, you can trigger this function to rotate all buttons.

e.g
[_expandMenuButton rotateAllButton]; img

- (void)showButtonIndex;

This function can show the index of every buttons. You will use it when using function behind, if you like.

- (void)turnedFrom:(int)indA to:(int)indB

You can exchange position the buttons' position by this function. And you need to know the index of the button by showButtonIndex function.

e.g
[_ExpandMenuButton turnedFrom:val1 to:val2]; img

Next Feature

If you want to add some special feature, you can start a pull request or a issue to tell me the good idea!

The MIT License (MIT)

Copyright (c) 2016 Desgard_Duan.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

More Repositories

1

iOS-Source-Probe

🔎 iOS 源码探求系列
Shell
911
star
2

DGDownloaderButton

Download Water Animation
Objective-C
229
star
3

BannerHoverView

便于构建 Header 悬停效果
Swift
162
star
4

DGThumbUpButton

DGThumbUpButton---有动画的点赞按钮
Objective-C
162
star
5

DGAdLaunchView

An iOS Launch Advertising View--登录页广告
Objective-C
79
star
6

WeCheat

基于 MonkeyDev 对 WeChat 的个人扩展
Objective-C
73
star
7

DGPopUpViewController

DGPopUpViewController---卡片式弹出窗口
Objective-C
67
star
8

DGSlimeView

DGSlimeView--模仿QQ消息小红点动画及粒子爆炸动效
Objective-C
64
star
9

DGCuteHelper

A helper Class to achieve adhesive Bond Effect between two UIView.
Objective-C
33
star
10

DGGooeySlideMenu

DGGooeySlideMenu---模仿skype照相按钮弹出菜单弹簧效果
Objective-C
24
star
11

LearningEveryDay

每天学习打卡
8
star
12

wechat-hc-helper

冬瓜群微信机器人🤖️
Python
8
star
13

desgard.github.com

Guardia · 瓜地
HTML
8
star
14

Gua-Vim

Personal vim configuration
Vim Script
7
star
15

leetmonster

JavaScript
7
star
16

SwiftGG-Translation-Demo

The Demo Code For My Translation In SwiftGG
Swift
6
star
17

swiftui-designcode-demo

DesignCode SwiftUI 视频学习
Swift
6
star
18

JianshuMarkdownParser.py

自己做的小脚本,从简书上将文章爬成krandom引擎md格式
Python
5
star
19

Shanbei-Homework

Objective-C
5
star
20

CameraDemo

The camera app effect demo by GPUImage.
Swift
5
star
21

INoteBook

基于 Gitbook 的个人笔记自动化发布 pages 的 shell脚本
HTML
4
star
22

Compiler

Swift
4
star
23

DGPanCollectionView

可拖动cell的Collection,不通过CollectionController实现
Swift
4
star
24

Panda-Run

Running ! Panda!!
Swift
4
star
25

learning-in-shiyanlou.com

Learning Programming in shiyanlou.com.
Python
4
star
26

RAC-Study-Note

3
star
27

Letchat

Objective-C
3
star
28

ARM64-step

Assembly
2
star
29

srtp-for-Zhou

This project is the Zhou's SRTP project!
Objective-C
2
star
30

HackSwjtuXZ

亲们好好玩。
JavaScript
2
star
31

nota

个人笔记同步仓库
Jupyter Notebook
2
star
32

Repobot

shiyanlou.com 周报自动化生成脚本
Python
2
star
33

macho-dumper

Mach-O dump tools. To analysis the Apple Mach-O binary file
C
2
star
34

algo

Ruby
2
star
35

gua-bk

JavaScript
2
star
36

react-native-calculator

JavaScript
1
star
37

ReadIt

Java
1
star
38

Flowercat

1
star
39

Jekyll-Score

CSS
1
star
40

shell

Common shell Script
Shell
1
star
41

Guanja

Python
1
star
42

WechatGptBot

TypeScript
1
star
43

DissCode-FE

DissCode 前端
Vue
1
star
44

Guajira

http://life.desgard.com
CSS
1
star
45

Desgarpy-Bird

冬瓜像素鸟
Swift
1
star
46

Guardia-Flask

Python
1
star
47

react-native-tools

1
star
48

Learning-Design-Patterns

To Learn Design Patterns in iOS, by using Objective-C
Objective-C
1
star
49

Careless

Swift
1
star
50

img

1
star
51

swjtu-pyscraper

Test Flask and scraper by python.
Python
1
star
52

Beacon-Flask

The production of Echo team in the Best Developer Competition of iQiYi.
Python
1
star