Swift - 炫酷放射弹出按钮菜单(改造自AwesomeMenu)

前端之家收集整理的这篇文章主要介绍了Swift - 炫酷放射弹出按钮菜单(改造自AwesomeMenu)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这个是一个第三方按钮菜单组件,原版是使用Objective-C编写的名为AwesomeMenu的组件,地址是: https://github.com/levey/AwesomeMenu

这里改造成了Swift版,效果图如下:
(2015.10.20再次修改,在Swift2下使用正常。)

使用代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import@H_403_208@ UIKit@H_403_208@
class@H_403_208@ ViewController@H_403_208@ :@H_403_208@ UIViewController@H_403_208@ ,@H_403_208@ HanggeSwiftMenuDelegate@H_403_208@ {@H_403_208@
@H_403_208@
@H_403_208@ override@H_403_208@ func@H_403_208@ viewDidLoad() {@H_403_208@
super@H_403_208@ .viewDidLoad()@H_403_208@
@H_403_208@
let@H_403_208@ storyMenuItemImage =@H_403_208@ UIImage@H_403_208@ (named:@H_403_208@ "bg-menuitem.png"@H_403_208@ )@H_403_208@
storyMenuItemImagePressed =@H_403_208@ "bg-menuitem-highlighted.png"@H_403_208@ )@H_403_208@
starImage =@H_403_208@ "icon-star.png"@H_403_208@ )@H_403_208@
@H_403_208@
@H_403_208@ // Default Menu@H_403_208@
starMenuItem1 =@H_403_208@ HanggeSwiftMenuItem@H_403_208@ (image:storyMenuItemImage!,@H_403_208@
@H_403_208@ highlightedImage:storyMenuItemImagePressed!,contentImage:starImage!,@H_403_208@
highlightedContentImage:@H_403_208@ nil@H_403_208@ )@H_403_208@
starMenuItem2 =@H_403_208@ 403_208@
403_208@
)@H_403_208@
starMenuItem3 =@H_403_208@ 403_208@
403_208@
)@H_403_208@
starMenuItem4 =@H_403_208@ 403_208@
403_208@
)@H_403_208@
starMenuItem5 =@H_403_208@ 403_208@
403_208@
)@H_403_208@
starMenuItem6 =@H_403_208@ 403_208@
403_208@
)@H_403_208@
starMenuItem7 =@H_403_208@ 403_208@
403_208@
)@H_403_208@
starMenuItem8 =@H_403_208@ 403_208@
403_208@
)@H_403_208@
starMenuItem9 =@H_403_208@ 403_208@
403_208@
)@H_403_208@
@H_403_208@
menus = [starMenuItem1,starMenuItem2,starMenuItem3,starMenuItem4,@H_403_208@
starMenuItem5,starMenuItem6,starMenuItem7,starMenuItem8,starMenuItem9]@H_403_208@
@H_403_208@
startItem =@H_403_208@ (image:@H_403_208@ "bg-addbutton.png"@H_403_208@ )!,@H_403_208@
highlightedImage:@H_403_208@ "bg-addbutton-highlighted.png"@H_403_208@ 403_208@
@H_403_403@contentImage:@H_403_208@ "icon-plus.png"@H_403_208@ 403_208@
highlightedContentImage:@H_403_208@ "icon-plus-highlighted.png"@H_403_208@ )@H_403_208@
)@H_403_208@
@H_403_208@
menu =@H_403_208@ HanggeSwiftMenu@H_403_208@ (frame:@H_403_208@ self@H_403_208@ .view.bounds,startItem:startItem,aMenusArray:menus)@H_403_208@
menu.delegate =@H_403_208@ self@H_403_208@
.view.addSubview(menu)@H_403_208@
}@H_403_208@
@H_403_208@
func@H_403_208@ SwiftSelectMenu@H_403_208@ (menu:@H_403_208@ 403_208@ Int@H_403_208@ )@H_403_208@
{@H_403_208@
@H_403_208@
@H_403_208@ print@H_403_208@ (@H_403_208@ "Select the index : %d"@H_403_208@ 403_208@
}@H_403_208@
@H_403_208@
HanggeSwiftMenuDidFinishAnimationClose@H_403_208@ )@H_403_208@
{@H_403_208@
@H_403_208@
"Menu was closed!"@H_403_208@ )@H_403_208@
}@H_403_208@
@H_403_208@
HanggeSwiftMenuDidFinishAnimationOpen@H_403_208@ )@H_403_208@
{@H_403_208@
@H_403_208@
"Menu is open!"@H_403_208@ )@H_403_208@
}@H_403_208@
@H_403_208@
HanggeSwiftMenuWillAnimateOpen@H_403_208@ )@H_403_208@
{@H_403_208@
@H_403_208@
}@H_403_208@
@H_403_208@
HanggeSwiftMenuWillAnimateClose@H_403_208@ )@H_403_208@
{@H_403_208@
@H_403_208@
}@H_403_208@
@H_403_208@
didReceiveMemoryWarning() {@H_403_208@
.didReceiveMemoryWarning()@H_403_208@
}@H_403_208@
}@H_403_208@
源码下载:HanggeMenu.zip

原文出自: www.hangge.com 转载请保留原文链接 http://www.hangge.com/blog/cache/detail_649.html 原文链接:https://www.f2er.com/swift/324623.html

猜你在找的Swift相关文章