Skip to content

Commit 30d06ae

Browse files
author
Daniel Dahan
committed
updated MenuView to handle outside touch events
1 parent d766953 commit 30d06ae

File tree

6 files changed

+149
-126
lines changed

6 files changed

+149
-126
lines changed

Examples/Programmatic/Menu/Menu/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class ViewController: UIViewController {
162162
// Initialize the menu and setup the configuration options.
163163
fabMenu = Menu(origin: CGPointMake(view.bounds.width - diameter - spacing, view.bounds.height - diameter - spacing))
164164
fabMenu.direction = .Up
165-
fabMenu.baseSize = CGSizeMake(diameter, diameter)
165+
fabMenu.baseViewSize = CGSizeMake(diameter, diameter)
166166
fabMenu.views = [btn1, btn2, btn3, btn4]
167167
}
168168

@@ -204,7 +204,7 @@ class ViewController: UIViewController {
204204
flatMenu = Menu(origin: CGPointMake(spacing, view.bounds.height - height - spacing))
205205
flatMenu.direction = .Up
206206
flatMenu.spacing = 8
207-
flatMenu.buttonSize = CGSizeMake(120, height)
207+
flatMenu.itemViewSize = CGSizeMake(120, height)
208208
flatMenu.views = [btn1, btn2, btn3, btn4]
209209
}
210210

@@ -238,7 +238,7 @@ class ViewController: UIViewController {
238238
// Initialize the menu and setup the configuration options.
239239
flashMenu = Menu(origin: CGPointMake((view.bounds.width + btn1.width) / 2, 100))
240240
flashMenu.direction = .Left
241-
flashMenu.buttonSize = btn1.intrinsicContentSize()
241+
flashMenu.itemViewSize = btn1.intrinsicContentSize()
242242
flashMenu.views = [btn1, btn2, btn3]
243243
}
244244
}

Examples/Programmatic/MenuView/MenuView/ViewController.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ class ViewController: UIViewController {
8383
first?.setImage(image, forState: .Highlighted)
8484
}
8585

86+
/// Handle the menuView touch event.
87+
internal func handleButton(button: UIButton) {
88+
print("Hit Button \(button)")
89+
}
90+
8691
/// General preparation statements are placed here.
8792
private func prepareView() {
8893
view.backgroundColor = MaterialColor.white
@@ -120,6 +125,7 @@ class ViewController: UIViewController {
120125
btn2.borderWidth = 1
121126
btn2.setImage(image, forState: .Normal)
122127
btn2.setImage(image, forState: .Highlighted)
128+
btn2.addTarget(self, action: "handleButton:", forControlEvents: .TouchUpInside)
123129
menuView.addSubview(btn2)
124130

125131
image = UIImage(named: "ic_photo_camera_white")?.imageWithRenderingMode(.AlwaysTemplate)
@@ -132,6 +138,7 @@ class ViewController: UIViewController {
132138
btn3.borderWidth = 1
133139
btn3.setImage(image, forState: .Normal)
134140
btn3.setImage(image, forState: .Highlighted)
141+
btn3.addTarget(self, action: "handleButton:", forControlEvents: .TouchUpInside)
135142
menuView.addSubview(btn3)
136143

137144
image = UIImage(named: "ic_note_add_white")?.imageWithRenderingMode(.AlwaysTemplate)
@@ -144,11 +151,12 @@ class ViewController: UIViewController {
144151
btn4.borderWidth = 1
145152
btn4.setImage(image, forState: .Normal)
146153
btn4.setImage(image, forState: .Highlighted)
154+
btn4.addTarget(self, action: "handleButton:", forControlEvents: .TouchUpInside)
147155
menuView.addSubview(btn4)
148156

149157
// Initialize the menu and setup the configuration options.
150158
menuView.menu.direction = .Up
151-
menuView.menu.baseSize = CGSizeMake(diameter, diameter)
159+
menuView.menu.baseViewSize = CGSizeMake(diameter, diameter)
152160
menuView.menu.views = [btn1, btn2, btn3, btn4]
153161

154162
view.addSubview(menuView)

Material.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Material'
3-
s.version = '1.32.1'
3+
s.version = '1.32.2'
44
s.license = 'BSD'
55
s.summary = 'Express your creativity with Material, an animation and graphics framework for Google\'s Material Design and Apple\'s Flat UI in Swift.'
66
s.homepage = 'http://cosmicmind.io'

Sources/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.32.1</string>
18+
<string>1.32.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

0 commit comments

Comments
 (0)