Commit f279cb2e by Daniel Dahan

updated MenuView to not call delegate methods until opened

parent 952aa351
......@@ -19,6 +19,8 @@
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; };
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.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 */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -28,6 +30,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
96FFF5841CFA64C5001E8048 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -49,6 +52,7 @@
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>"; };
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 */
/* Begin PBXFrameworksBuildPhase section */
......@@ -56,6 +60,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
96FFF5831CFA64C5001E8048 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -65,6 +70,7 @@
9663F9251C7A744500AF0965 = {
isa = PBXGroup;
children = (
96FFF5821CFA64C5001E8048 /* Material.framework */,
9663F9301C7A744600AF0965 /* App */,
9663F92F1C7A744600AF0965 /* Products */,
);
......
......@@ -103,12 +103,10 @@ class AppMenuController: MenuController, MenuViewDelegate {
}
}
/// Prepares the menuView.
private func prepareMenuView() {
menuView.delegate = self
var image: UIImage? = MaterialIcon.cm.add
var image: UIImage? = MaterialIcon.cm.add
let menuButton: FabButton = FabButton()
menuButton.tintColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal)
......@@ -146,6 +144,7 @@ class AppMenuController: MenuController, MenuViewDelegate {
// Initialize the menu and setup the configuration options.
menuView.menu.baseSize = baseSize
menuView.menu.views = [menuButton, blueButton, greenButton, yellowButton]
menuView.delegate = self
view.addSubview(menuView)
MaterialLayout.size(view, child: menuView, width: baseSize.width, height: baseSize.height)
......
......@@ -14,8 +14,6 @@
966ECF6C1CF616F500BB0BDF /* BlueViewcontroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966ECF681CF616F500BB0BDF /* BlueViewcontroller.swift */; };
966ECF6D1CF616F500BB0BDF /* GreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966ECF691CF616F500BB0BDF /* GreenViewController.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 */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -25,7 +23,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
96FFF57B1CFA52DC001E8048 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -42,7 +39,6 @@
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>"; };
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 */
/* Begin PBXFrameworksBuildPhase section */
......@@ -50,7 +46,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
96FFF57A1CFA52DC001E8048 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -60,7 +55,6 @@
966ECF451CF6162F00BB0BDF = {
isa = PBXGroup;
children = (
96FFF5791CFA52DC001E8048 /* Material.framework */,
966ECF501CF6162F00BB0BDF /* MenuController */,
966ECF4F1CF6162F00BB0BDF /* Products */,
);
......
......@@ -113,39 +113,43 @@ class AppMenuController: MenuController, MenuViewDelegate {
/// Prepares the add button.
private func prepareMenuView() {
var image: UIImage? = MaterialIcon.cm.add
let btn1: FabButton = FabButton()
btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(btn1)
let menuButton: FabButton = FabButton()
menuButton.tintColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal)
menuButton.setImage(image, forState: .Highlighted)
menuButton.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(menuButton)
image = MaterialIcon.cm.videocam
let btn2: FabButton = FabButton()
btn2.backgroundColor = MaterialColor.blue.base
btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted)
menuView.addSubview(btn2)
btn2.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.pen
let blueButton: FabButton = FabButton()
blueButton.tintColor = MaterialColor.white
blueButton.backgroundColor = MaterialColor.blue.base
blueButton.setImage(image, forState: .Normal)
blueButton.setImage(image, forState: .Highlighted)
menuView.addSubview(blueButton)
blueButton.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.photoLibrary
let btn3: FabButton = FabButton()
btn3.backgroundColor = MaterialColor.green.base
btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted)
menuView.addSubview(btn3)
btn3.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.photoCamera
let greenButton: FabButton = FabButton()
greenButton.tintColor = MaterialColor.white
greenButton.backgroundColor = MaterialColor.green.base
greenButton.setImage(image, forState: .Normal)
greenButton.setImage(image, forState: .Highlighted)
menuView.addSubview(greenButton)
greenButton.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.pen
let btn4: FabButton = FabButton()
btn4.backgroundColor = MaterialColor.yellow.base
btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted)
menuView.addSubview(btn4)
btn4.addTarget(self, action: #selector(handleYellowButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.star
let yellowButton: FabButton = FabButton()
yellowButton.tintColor = MaterialColor.white
yellowButton.backgroundColor = MaterialColor.yellow.base
yellowButton.setImage(image, forState: .Normal)
yellowButton.setImage(image, forState: .Highlighted)
menuView.addSubview(yellowButton)
yellowButton.addTarget(self, action: #selector(handleYellowButton), forControlEvents: .TouchUpInside)
// Initialize the menu and setup the configuration options.
menuView.menu.baseSize = baseSize
menuView.menu.views = [btn1, btn2, btn3, btn4]
menuView.menu.views = [menuButton, blueButton, greenButton, yellowButton]
menuView.delegate = self
view.addSubview(menuView)
......
......@@ -7,8 +7,6 @@
objects = {
/* 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 */; };
96A71EA21C6FC12000C0C4AE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EA11C6FC12000C0C4AE /* ViewController.swift */; };
96A71EA71C6FC12000C0C4AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96A71EA61C6FC12000C0C4AE /* Assets.xcassets */; };
......@@ -22,7 +20,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
966ECEBF1CEBBC3A00BB0BDF /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -30,7 +27,6 @@
/* End PBXCopyFilesBuildPhase 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; };
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>"; };
......@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
966ECEBE1CEBBC3A00BB0BDF /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -54,7 +49,6 @@
96A71E931C6FC12000C0C4AE = {
isa = PBXGroup;
children = (
966ECEBD1CEBBC3A00BB0BDF /* Material.framework */,
96A71E9E1C6FC12000C0C4AE /* MenuView */,
96A71E9D1C6FC12000C0C4AE /* Products */,
);
......
......@@ -105,9 +105,9 @@ public class MenuView : MaterialPulseView {
}
}
// if menu.opened {
// (delegate as? MenuViewDelegate)?.menuViewDidTapOutside?(self)
// }
if menu.opened {
(delegate as? MenuViewDelegate)?.menuViewDidTapOutside?(self)
}
return super.hitTest(point, withEvent: event)
}
......
......@@ -423,7 +423,7 @@ public class NavigationBar : UINavigationBar {
when subclassing.
*/
public func prepareView() {
barStyle = .Default
barStyle = .Black
translucent = false
depth = .Depth1
spacingPreset = .Spacing1
......
......@@ -61,12 +61,6 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
public override func viewDidLoad() {
super.viewDidLoad()
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) {
......@@ -148,5 +142,11 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
public func prepareView() {
view.clipsToBounds = true
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