Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
097b6c06
Unverified
Commit
097b6c06
authored
May 29, 2016
by
M. Porooshani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added MenuViewDelegate for touch outside menu buttons
parent
41ca8398
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletions
+23
-1
Examples/Programmatic/App/App/AppMenuViewController.swift
+9
-1
Sources/iOS/MenuView.swift
+14
-0
No files found.
Examples/Programmatic/App/App/AppMenuViewController.swift
View file @
097b6c06
...
...
@@ -36,7 +36,7 @@ flow of your application.
import
UIKit
import
Material
class
AppMenuController
:
MenuController
{
class
AppMenuController
:
MenuController
,
MenuViewDelegate
{
/// MenuView diameter.
private
let
baseSize
:
CGSize
=
CGSizeMake
(
56
,
56
)
...
...
@@ -74,6 +74,11 @@ class AppMenuController: MenuController {
(
menuView
.
menu
.
views
?
.
first
as?
MaterialButton
)?
.
animate
(
MaterialAnimation
.
rotate
(
angle
:
0
))
}
// Handles touch outside
func
menuViewDidTapOutside
(
menuView
:
MenuView
)
{
closeMenu
()
}
/// Handler for blue button.
func
handleBlueButton
()
{
closeMenu
()
...
...
@@ -100,6 +105,9 @@ class AppMenuController: MenuController {
/// Prepares the menuView.
private
func
prepareMenuView
()
{
menuView
.
delegate
=
self
var
image
:
UIImage
?
=
MaterialIcon
.
cm
.
add
let
menuButton
:
FabButton
=
FabButton
()
menuButton
.
tintColor
=
MaterialColor
.
white
...
...
Sources/iOS/MenuView.swift
View file @
097b6c06
...
...
@@ -30,6 +30,16 @@
import
UIKit
@objc(MenuViewDelegate)
public
protocol
MenuViewDelegate
:
MaterialDelegate
{
/**
:name: menuViewDidTapOutside
*/
func
menuViewDidTapOutside
(
menuView
:
MenuView
)
}
public
class
MenuView
:
MaterialPulseView
{
/// References the Menu instance.
public
private(set)
lazy
var
menu
:
Menu
=
Menu
(
origin
:
CGPointZero
)
...
...
@@ -96,6 +106,9 @@ public class MenuView : MaterialPulseView {
return
v
.
hitTest
(
p
,
withEvent
:
event
)
}
}
(
delegate
as?
MenuViewDelegate
)?
.
menuViewDidTapOutside
(
self
)
return
super
.
hitTest
(
point
,
withEvent
:
event
)
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment