Commit bfa2cd30 by danieldahan

removed MenuView for lighter-weighted MenuLayout approach

parent 1c8824e5
...@@ -36,19 +36,19 @@ import UIKit ...@@ -36,19 +36,19 @@ import UIKit
import Material import Material
class ViewController: UIViewController { class ViewController: UIViewController {
private var menuView: MenuView! private var menuView: MenuLayout!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareMenuViewExample() prepareMenuLayoutExample()
} }
internal func handleOpenMenuView() { internal func handleOpenMenuLayout() {
if menuView.opened { if menuView.opened {
menuView.close() menuView.close()
} else { } else {
menuView.open() { (item: MenuViewItem) in menuView.open() { (item: MenuLayoutItem) in
(item.button as? MaterialButton)?.pulse() (item.button as? MaterialButton)?.pulse()
} }
} }
...@@ -59,45 +59,54 @@ class ViewController: UIViewController { ...@@ -59,45 +59,54 @@ class ViewController: UIViewController {
view.backgroundColor = MaterialColor.white view.backgroundColor = MaterialColor.white
} }
/// Prepares the MenuView example. /// Prepares the MenuLayout example.
private func prepareMenuViewExample() { private func prepareMenuLayoutExample() {
let btn: FlatButton = FlatButton(frame: CGRectMake(100, 100, 100, 100))
btn.backgroundColor = MaterialColor.red.base
let image: UIImage? = UIImage(named: "ic_add_white") let image: UIImage? = UIImage(named: "ic_add_white")
let btn1: FabButton = FabButton() let btn1: FabButton = FabButton()
btn1.depth = .None btn1.depth = .None
btn1.setImage(image, forState: .Normal) btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted) btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleOpenMenuView", forControlEvents: .TouchUpInside) btn1.addTarget(self, action: "handleOpenMenuLayout", forControlEvents: .TouchUpInside)
view.addSubview(btn1)
let btn2: FabButton = FabButton() let btn2: FabButton = FabButton()
btn2.depth = .None btn2.depth = .None
btn2.backgroundColor = MaterialColor.blue.base btn2.backgroundColor = MaterialColor.blue.base
btn2.setImage(image, forState: .Normal) btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted) btn2.setImage(image, forState: .Highlighted)
view.addSubview(btn2)
let btn3: FabButton = FabButton() let btn3: FabButton = FabButton()
btn3.depth = .None btn3.depth = .None
btn3.backgroundColor = MaterialColor.green.base btn3.backgroundColor = MaterialColor.green.base
btn3.setImage(image, forState: .Normal) btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted) btn3.setImage(image, forState: .Highlighted)
view.addSubview(btn3)
let btn4: FabButton = FabButton() let btn4: FabButton = FabButton()
btn4.depth = .None btn4.depth = .None
btn4.backgroundColor = MaterialColor.yellow.base btn4.backgroundColor = MaterialColor.yellow.base
btn4.setImage(image, forState: .Normal) btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted) btn4.setImage(image, forState: .Highlighted)
view.addSubview(btn4)
menuView = MenuView(frame: view.bounds) menuView = MenuLayout()
// menuView.menuPosition = .BottomLeft menuView.menuPosition = .TopRight
// menuView.menuDirection = .Up menuView.menuDirection = .Left
menuView.baseSize = CGSizeMake(36, 36) menuView.baseSize = CGSizeMake(36, 36)
menuView.itemSize = CGSizeMake(36, 36) menuView.itemSize = CGSizeMake(36, 36)
view.addSubview(menuView)
view.addSubview(btn)
menuView.menuItems = [ menuView.menuItems = [
MenuViewItem(button: btn1), MenuLayoutItem(button: btn1),
MenuViewItem(button: btn2), MenuLayoutItem(button: btn2),
MenuViewItem(button: btn3), MenuLayoutItem(button: btn3),
MenuViewItem(button: btn4) MenuLayoutItem(button: btn4)
] ]
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
65FDC2EB1C66858A00103AC2 /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FDC2EA1C66858A00103AC2 /* MenuView.swift */; }; 65FDC2EB1C66858A00103AC2 /* MenuLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65FDC2EA1C66858A00103AC2 /* MenuLayout.swift */; };
960B23271C383E5500E96216 /* Material+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960B23261C383E5500E96216 /* Material+String.swift */; }; 960B23271C383E5500E96216 /* Material+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960B23261C383E5500E96216 /* Material+String.swift */; };
960B232E1C383EAA00E96216 /* Material+UIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960B23281C383EAA00E96216 /* Material+UIImage.swift */; }; 960B232E1C383EAA00E96216 /* Material+UIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960B23281C383EAA00E96216 /* Material+UIImage.swift */; };
960B232F1C383EAA00E96216 /* Material+UIImage+Crop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960B23291C383EAA00E96216 /* Material+UIImage+Crop.swift */; }; 960B232F1C383EAA00E96216 /* Material+UIImage+Crop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960B23291C383EAA00E96216 /* Material+UIImage+Crop.swift */; };
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
65FDC2EA1C66858A00103AC2 /* MenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuView.swift; sourceTree = "<group>"; }; 65FDC2EA1C66858A00103AC2 /* MenuLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuLayout.swift; sourceTree = "<group>"; };
960B23261C383E5500E96216 /* Material+String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+String.swift"; sourceTree = "<group>"; }; 960B23261C383E5500E96216 /* Material+String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+String.swift"; sourceTree = "<group>"; };
960B23281C383EAA00E96216 /* Material+UIImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage.swift"; sourceTree = "<group>"; }; 960B23281C383EAA00E96216 /* Material+UIImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage.swift"; sourceTree = "<group>"; };
960B23291C383EAA00E96216 /* Material+UIImage+Crop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage+Crop.swift"; sourceTree = "<group>"; }; 960B23291C383EAA00E96216 /* Material+UIImage+Crop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage+Crop.swift"; sourceTree = "<group>"; };
...@@ -393,7 +393,7 @@ ...@@ -393,7 +393,7 @@
children = ( children = (
96D88C151C1328D800B91418 /* NavigationBarView.swift */, 96D88C151C1328D800B91418 /* NavigationBarView.swift */,
96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */, 96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */,
65FDC2EA1C66858A00103AC2 /* MenuView.swift */, 65FDC2EA1C66858A00103AC2 /* MenuLayout.swift */,
); );
name = Navigation; name = Navigation;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -585,7 +585,7 @@ ...@@ -585,7 +585,7 @@
96D88C3E1C1328D800B91418 /* NavigationBarView.swift in Sources */, 96D88C3E1C1328D800B91418 /* NavigationBarView.swift in Sources */,
96D88C221C1328D800B91418 /* FabButton.swift in Sources */, 96D88C221C1328D800B91418 /* FabButton.swift in Sources */,
96D88C3F1C1328D800B91418 /* RaisedButton.swift in Sources */, 96D88C3F1C1328D800B91418 /* RaisedButton.swift in Sources */,
65FDC2EB1C66858A00103AC2 /* MenuView.swift in Sources */, 65FDC2EB1C66858A00103AC2 /* MenuLayout.swift in Sources */,
960B23311C383EAA00E96216 /* Material+UIImage+PhotoLibrary.swift in Sources */, 960B23311C383EAA00E96216 /* Material+UIImage+PhotoLibrary.swift in Sources */,
960B23321C383EAA00E96216 /* Material+UIImage+Resize.swift in Sources */, 960B23321C383EAA00E96216 /* Material+UIImage+Resize.swift in Sources */,
96D88C3C1C1328D800B91418 /* MaterialTransitionAnimation.swift in Sources */, 96D88C3C1C1328D800B91418 /* MaterialTransitionAnimation.swift in Sources */,
......
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