Commit f279cb2e by Daniel Dahan

updated MenuView to not call delegate methods until opened

parent 952aa351
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; }; 9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; };
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; }; 9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; };
96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; }; 96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; };
96FFF5831CFA64C5001E8048 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96FFF5821CFA64C5001E8048 /* Material.framework */; };
96FFF5841CFA64C5001E8048 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96FFF5821CFA64C5001E8048 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -28,6 +30,7 @@ ...@@ -28,6 +30,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96FFF5841CFA64C5001E8048 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -49,6 +52,7 @@ ...@@ -49,6 +52,7 @@
9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; }; 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; };
9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; }; 9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; };
96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; }; 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; };
96FFF5821CFA64C5001E8048 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -56,6 +60,7 @@ ...@@ -56,6 +60,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96FFF5831CFA64C5001E8048 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -65,6 +70,7 @@ ...@@ -65,6 +70,7 @@
9663F9251C7A744500AF0965 = { 9663F9251C7A744500AF0965 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96FFF5821CFA64C5001E8048 /* Material.framework */,
9663F9301C7A744600AF0965 /* App */, 9663F9301C7A744600AF0965 /* App */,
9663F92F1C7A744600AF0965 /* Products */, 9663F92F1C7A744600AF0965 /* Products */,
); );
......
...@@ -103,12 +103,10 @@ class AppMenuController: MenuController, MenuViewDelegate { ...@@ -103,12 +103,10 @@ class AppMenuController: MenuController, MenuViewDelegate {
} }
} }
/// Prepares the menuView. /// Prepares the menuView.
private func prepareMenuView() { private func prepareMenuView() {
var image: UIImage? = MaterialIcon.cm.add
menuView.delegate = self
var image: UIImage? = MaterialIcon.cm.add
let menuButton: FabButton = FabButton() let menuButton: FabButton = FabButton()
menuButton.tintColor = MaterialColor.white menuButton.tintColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal) menuButton.setImage(image, forState: .Normal)
...@@ -146,6 +144,7 @@ class AppMenuController: MenuController, MenuViewDelegate { ...@@ -146,6 +144,7 @@ class AppMenuController: MenuController, MenuViewDelegate {
// Initialize the menu and setup the configuration options. // Initialize the menu and setup the configuration options.
menuView.menu.baseSize = baseSize menuView.menu.baseSize = baseSize
menuView.menu.views = [menuButton, blueButton, greenButton, yellowButton] menuView.menu.views = [menuButton, blueButton, greenButton, yellowButton]
menuView.delegate = self
view.addSubview(menuView) view.addSubview(menuView)
MaterialLayout.size(view, child: menuView, width: baseSize.width, height: baseSize.height) MaterialLayout.size(view, child: menuView, width: baseSize.width, height: baseSize.height)
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
966ECF6C1CF616F500BB0BDF /* BlueViewcontroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966ECF681CF616F500BB0BDF /* BlueViewcontroller.swift */; }; 966ECF6C1CF616F500BB0BDF /* BlueViewcontroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966ECF681CF616F500BB0BDF /* BlueViewcontroller.swift */; };
966ECF6D1CF616F500BB0BDF /* GreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966ECF691CF616F500BB0BDF /* GreenViewController.swift */; }; 966ECF6D1CF616F500BB0BDF /* GreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966ECF691CF616F500BB0BDF /* GreenViewController.swift */; };
966ECF6E1CF616F500BB0BDF /* YellowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966ECF6A1CF616F500BB0BDF /* YellowViewController.swift */; }; 966ECF6E1CF616F500BB0BDF /* YellowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966ECF6A1CF616F500BB0BDF /* YellowViewController.swift */; };
96FFF57A1CFA52DC001E8048 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96FFF5791CFA52DC001E8048 /* Material.framework */; };
96FFF57B1CFA52DC001E8048 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96FFF5791CFA52DC001E8048 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -25,7 +23,6 @@ ...@@ -25,7 +23,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96FFF57B1CFA52DC001E8048 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -42,7 +39,6 @@ ...@@ -42,7 +39,6 @@
966ECF681CF616F500BB0BDF /* BlueViewcontroller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlueViewcontroller.swift; sourceTree = "<group>"; }; 966ECF681CF616F500BB0BDF /* BlueViewcontroller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlueViewcontroller.swift; sourceTree = "<group>"; };
966ECF691CF616F500BB0BDF /* GreenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GreenViewController.swift; sourceTree = "<group>"; }; 966ECF691CF616F500BB0BDF /* GreenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GreenViewController.swift; sourceTree = "<group>"; };
966ECF6A1CF616F500BB0BDF /* YellowViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YellowViewController.swift; sourceTree = "<group>"; }; 966ECF6A1CF616F500BB0BDF /* YellowViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YellowViewController.swift; sourceTree = "<group>"; };
96FFF5791CFA52DC001E8048 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/CosmicMind-hgvxkqfizbxkrsfcxbtlafgqkbve/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -50,7 +46,6 @@ ...@@ -50,7 +46,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96FFF57A1CFA52DC001E8048 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -60,7 +55,6 @@ ...@@ -60,7 +55,6 @@
966ECF451CF6162F00BB0BDF = { 966ECF451CF6162F00BB0BDF = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96FFF5791CFA52DC001E8048 /* Material.framework */,
966ECF501CF6162F00BB0BDF /* MenuController */, 966ECF501CF6162F00BB0BDF /* MenuController */,
966ECF4F1CF6162F00BB0BDF /* Products */, 966ECF4F1CF6162F00BB0BDF /* Products */,
); );
......
...@@ -113,39 +113,43 @@ class AppMenuController: MenuController, MenuViewDelegate { ...@@ -113,39 +113,43 @@ class AppMenuController: MenuController, MenuViewDelegate {
/// Prepares the add button. /// Prepares the add button.
private func prepareMenuView() { private func prepareMenuView() {
var image: UIImage? = MaterialIcon.cm.add var image: UIImage? = MaterialIcon.cm.add
let btn1: FabButton = FabButton() let menuButton: FabButton = FabButton()
btn1.setImage(image, forState: .Normal) menuButton.tintColor = MaterialColor.white
btn1.setImage(image, forState: .Highlighted) menuButton.setImage(image, forState: .Normal)
btn1.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside) menuButton.setImage(image, forState: .Highlighted)
menuView.addSubview(btn1) menuButton.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(menuButton)
image = MaterialIcon.cm.videocam image = MaterialIcon.cm.pen
let btn2: FabButton = FabButton() let blueButton: FabButton = FabButton()
btn2.backgroundColor = MaterialColor.blue.base blueButton.tintColor = MaterialColor.white
btn2.setImage(image, forState: .Normal) blueButton.backgroundColor = MaterialColor.blue.base
btn2.setImage(image, forState: .Highlighted) blueButton.setImage(image, forState: .Normal)
menuView.addSubview(btn2) blueButton.setImage(image, forState: .Highlighted)
btn2.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside) menuView.addSubview(blueButton)
blueButton.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.photoLibrary image = MaterialIcon.cm.photoCamera
let btn3: FabButton = FabButton() let greenButton: FabButton = FabButton()
btn3.backgroundColor = MaterialColor.green.base greenButton.tintColor = MaterialColor.white
btn3.setImage(image, forState: .Normal) greenButton.backgroundColor = MaterialColor.green.base
btn3.setImage(image, forState: .Highlighted) greenButton.setImage(image, forState: .Normal)
menuView.addSubview(btn3) greenButton.setImage(image, forState: .Highlighted)
btn3.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside) menuView.addSubview(greenButton)
greenButton.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.pen image = MaterialIcon.cm.star
let btn4: FabButton = FabButton() let yellowButton: FabButton = FabButton()
btn4.backgroundColor = MaterialColor.yellow.base yellowButton.tintColor = MaterialColor.white
btn4.setImage(image, forState: .Normal) yellowButton.backgroundColor = MaterialColor.yellow.base
btn4.setImage(image, forState: .Highlighted) yellowButton.setImage(image, forState: .Normal)
menuView.addSubview(btn4) yellowButton.setImage(image, forState: .Highlighted)
btn4.addTarget(self, action: #selector(handleYellowButton), forControlEvents: .TouchUpInside) menuView.addSubview(yellowButton)
yellowButton.addTarget(self, action: #selector(handleYellowButton), forControlEvents: .TouchUpInside)
// Initialize the menu and setup the configuration options. // Initialize the menu and setup the configuration options.
menuView.menu.baseSize = baseSize menuView.menu.baseSize = baseSize
menuView.menu.views = [btn1, btn2, btn3, btn4] menuView.menu.views = [menuButton, blueButton, greenButton, yellowButton]
menuView.delegate = self menuView.delegate = self
view.addSubview(menuView) view.addSubview(menuView)
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
966ECEBE1CEBBC3A00BB0BDF /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 966ECEBD1CEBBC3A00BB0BDF /* Material.framework */; };
966ECEBF1CEBBC3A00BB0BDF /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 966ECEBD1CEBBC3A00BB0BDF /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96A71EA01C6FC12000C0C4AE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71E9F1C6FC12000C0C4AE /* AppDelegate.swift */; }; 96A71EA01C6FC12000C0C4AE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71E9F1C6FC12000C0C4AE /* AppDelegate.swift */; };
96A71EA21C6FC12000C0C4AE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EA11C6FC12000C0C4AE /* ViewController.swift */; }; 96A71EA21C6FC12000C0C4AE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EA11C6FC12000C0C4AE /* ViewController.swift */; };
96A71EA71C6FC12000C0C4AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96A71EA61C6FC12000C0C4AE /* Assets.xcassets */; }; 96A71EA71C6FC12000C0C4AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96A71EA61C6FC12000C0C4AE /* Assets.xcassets */; };
...@@ -22,7 +20,6 @@ ...@@ -22,7 +20,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
966ECEBF1CEBBC3A00BB0BDF /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -30,7 +27,6 @@ ...@@ -30,7 +27,6 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
966ECEBD1CEBBC3A00BB0BDF /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
96A71E9C1C6FC12000C0C4AE /* MenuView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MenuView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 96A71E9C1C6FC12000C0C4AE /* MenuView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MenuView.app; sourceTree = BUILT_PRODUCTS_DIR; };
96A71E9F1C6FC12000C0C4AE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 96A71E9F1C6FC12000C0C4AE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96A71EA11C6FC12000C0C4AE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 96A71EA11C6FC12000C0C4AE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
...@@ -44,7 +40,6 @@ ...@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
966ECEBE1CEBBC3A00BB0BDF /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
96A71E931C6FC12000C0C4AE = { 96A71E931C6FC12000C0C4AE = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
966ECEBD1CEBBC3A00BB0BDF /* Material.framework */,
96A71E9E1C6FC12000C0C4AE /* MenuView */, 96A71E9E1C6FC12000C0C4AE /* MenuView */,
96A71E9D1C6FC12000C0C4AE /* Products */, 96A71E9D1C6FC12000C0C4AE /* Products */,
); );
......
...@@ -105,9 +105,9 @@ public class MenuView : MaterialPulseView { ...@@ -105,9 +105,9 @@ public class MenuView : MaterialPulseView {
} }
} }
// if menu.opened { if menu.opened {
// (delegate as? MenuViewDelegate)?.menuViewDidTapOutside?(self) (delegate as? MenuViewDelegate)?.menuViewDidTapOutside?(self)
// } }
return super.hitTest(point, withEvent: event) return super.hitTest(point, withEvent: event)
} }
......
...@@ -423,7 +423,7 @@ public class NavigationBar : UINavigationBar { ...@@ -423,7 +423,7 @@ public class NavigationBar : UINavigationBar {
when subclassing. when subclassing.
*/ */
public func prepareView() { public func prepareView() {
barStyle = .Default barStyle = .Black
translucent = false translucent = false
depth = .Depth1 depth = .Depth1
spacingPreset = .Spacing1 spacingPreset = .Spacing1
......
...@@ -61,12 +61,6 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD ...@@ -61,12 +61,6 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
public override func viewDidLoad() { public override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
// This ensures the panning gesture is available when going back between views.
if let v: UIGestureRecognizer = interactivePopGestureRecognizer {
v.enabled = true
v.delegate = self
}
} }
public override func viewWillAppear(animated: Bool) { public override func viewWillAppear(animated: Bool) {
...@@ -148,5 +142,11 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD ...@@ -148,5 +142,11 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
public func prepareView() { public func prepareView() {
view.clipsToBounds = true view.clipsToBounds = true
view.contentScaleFactor = MaterialDevice.scale view.contentScaleFactor = MaterialDevice.scale
// This ensures the panning gesture is available when going back between views.
if let v: UIGestureRecognizer = interactivePopGestureRecognizer {
v.enabled = true
v.delegate = self
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment