Commit bfa2cd30 by danieldahan

removed MenuView for lighter-weighted MenuLayout approach

parent 1c8824e5
......@@ -36,19 +36,19 @@ import UIKit
import Material
class ViewController: UIViewController {
private var menuView: MenuView!
private var menuView: MenuLayout!
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareMenuViewExample()
prepareMenuLayoutExample()
}
internal func handleOpenMenuView() {
internal func handleOpenMenuLayout() {
if menuView.opened {
menuView.close()
} else {
menuView.open() { (item: MenuViewItem) in
menuView.open() { (item: MenuLayoutItem) in
(item.button as? MaterialButton)?.pulse()
}
}
......@@ -59,45 +59,54 @@ class ViewController: UIViewController {
view.backgroundColor = MaterialColor.white
}
/// Prepares the MenuView example.
private func prepareMenuViewExample() {
/// Prepares the MenuLayout example.
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 btn1: FabButton = FabButton()
btn1.depth = .None
btn1.setImage(image, forState: .Normal)
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()
btn2.depth = .None
btn2.backgroundColor = MaterialColor.blue.base
btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted)
view.addSubview(btn2)
let btn3: FabButton = FabButton()
btn3.depth = .None
btn3.backgroundColor = MaterialColor.green.base
btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted)
view.addSubview(btn3)
let btn4: FabButton = FabButton()
btn4.depth = .None
btn4.backgroundColor = MaterialColor.yellow.base
btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted)
view.addSubview(btn4)
menuView = MenuView(frame: view.bounds)
// menuView.menuPosition = .BottomLeft
// menuView.menuDirection = .Up
menuView = MenuLayout()
menuView.menuPosition = .TopRight
menuView.menuDirection = .Left
menuView.baseSize = CGSizeMake(36, 36)
menuView.itemSize = CGSizeMake(36, 36)
view.addSubview(menuView)
view.addSubview(btn)
menuView.menuItems = [
MenuViewItem(button: btn1),
MenuViewItem(button: btn2),
MenuViewItem(button: btn3),
MenuViewItem(button: btn4)
MenuLayoutItem(button: btn1),
MenuLayoutItem(button: btn2),
MenuLayoutItem(button: btn3),
MenuLayoutItem(button: btn4)
]
}
}
......
......@@ -7,7 +7,7 @@
objects = {
/* 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 */; };
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 */; };
......@@ -115,7 +115,7 @@
/* End PBXContainerItemProxy 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>"; };
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>"; };
......@@ -393,7 +393,7 @@
children = (
96D88C151C1328D800B91418 /* NavigationBarView.swift */,
96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */,
65FDC2EA1C66858A00103AC2 /* MenuView.swift */,
65FDC2EA1C66858A00103AC2 /* MenuLayout.swift */,
);
name = Navigation;
sourceTree = "<group>";
......@@ -585,7 +585,7 @@
96D88C3E1C1328D800B91418 /* NavigationBarView.swift in Sources */,
96D88C221C1328D800B91418 /* FabButton.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 */,
960B23321C383EAA00E96216 /* Material+UIImage+Resize.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