Commit d7669534 by Daniel Dahan

added MenuView, a UIView wrapper around Menu

parent 5e4d6fb5
......@@ -69,6 +69,9 @@
<FileRef
location = "group:Programmatic/Menu/Menu.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/MenuView/MenuView.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"
......
......@@ -277,7 +277,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
captureButton.height = 72
captureButton.pulseColor = MaterialColor.white
captureButton.backgroundColor = MaterialColor.red.darken1.colorWithAlphaComponent(0.3)
captureButton.borderWidth = .Border2
captureButton.borderWidth = 2
captureButton.borderColor = MaterialColor.white
captureButton.depth = .None
......
......@@ -30,7 +30,7 @@
/**
This is an example of using the Menu component. It is designed to take any array
of buttons and provide a facility to animate them opened and closed as a group.
of views and provide a facility to animate them opened and closed as a group.
*/
import UIKit
......@@ -76,24 +76,23 @@ class ViewController: UIViewController {
/// Handle the fabMenu touch event.
internal func handleFabMenu() {
// Only trigger open and close animations when enabled.
if fabMenu.enabled {
let image: UIImage?
if fabMenu.opened {
fabMenu.close()
image = UIImage(named: "ic_add_white")
} else {
fabMenu.open() { (button: UIButton) in
(button as? MaterialButton)?.pulse()
}
image = UIImage(named: "ic_close_white")
let image: UIImage?
if fabMenu.opened {
fabMenu.close()
image = UIImage(named: "ic_add_white")
} else {
fabMenu.open() { (v: UIView) in
(v as? MaterialButton)?.pulse()
}
// Add a nice rotation animation to the base button.
(fabMenu.buttons?.first as? MaterialButton)?.animate(MaterialAnimation.rotate(1))
fabMenu.buttons?.first?.setImage(image, forState: .Normal)
fabMenu.buttons?.first?.setImage(image, forState: .Highlighted)
image = UIImage(named: "ic_close_white")
}
// Add a nice rotation animation to the base button.
let first: MaterialButton? = fabMenu.views?.first as? MaterialButton
first?.animate(MaterialAnimation.rotate(1))
first?.setImage(image, forState: .Normal)
first?.setImage(image, forState: .Highlighted)
}
/// Handle the flatMenu touch event.
......@@ -164,7 +163,7 @@ class ViewController: UIViewController {
fabMenu = Menu(origin: CGPointMake(view.bounds.width - diameter - spacing, view.bounds.height - diameter - spacing))
fabMenu.direction = .Up
fabMenu.baseSize = CGSizeMake(diameter, diameter)
fabMenu.buttons = [btn1, btn2, btn3, btn4]
fabMenu.views = [btn1, btn2, btn3, btn4]
}
/// Prepares the FlatMenu example.
......@@ -181,7 +180,7 @@ class ViewController: UIViewController {
btn2.setTitleColor(MaterialColor.blue.accent3, forState: .Normal)
btn2.borderColor = MaterialColor.blue.accent3
btn2.pulseColor = MaterialColor.blue.accent3
btn2.borderWidth = .Border1
btn2.borderWidth = 1
btn2.setTitle("Item", forState: .Normal)
view.addSubview(btn2)
......@@ -189,7 +188,7 @@ class ViewController: UIViewController {
btn3.setTitleColor(MaterialColor.blue.accent3, forState: .Normal)
btn3.borderColor = MaterialColor.blue.accent3
btn3.pulseColor = MaterialColor.blue.accent3
btn3.borderWidth = .Border1
btn3.borderWidth = 1
btn3.setTitle("Item", forState: .Normal)
view.addSubview(btn3)
......@@ -197,7 +196,7 @@ class ViewController: UIViewController {
btn4.setTitleColor(MaterialColor.blue.accent3, forState: .Normal)
btn4.borderColor = MaterialColor.blue.accent3
btn4.pulseColor = MaterialColor.blue.accent3
btn4.borderWidth = .Border1
btn4.borderWidth = 1
btn4.setTitle("Item", forState: .Normal)
view.addSubview(btn4)
......@@ -206,7 +205,7 @@ class ViewController: UIViewController {
flatMenu.direction = .Up
flatMenu.spacing = 8
flatMenu.buttonSize = CGSizeMake(120, height)
flatMenu.buttons = [btn1, btn2, btn3, btn4]
flatMenu.views = [btn1, btn2, btn3, btn4]
}
/// Prepares the FlashMenu example.
......@@ -240,7 +239,7 @@ class ViewController: UIViewController {
flashMenu = Menu(origin: CGPointMake((view.bounds.width + btn1.width) / 2, 100))
flashMenu.direction = .Left
flashMenu.buttonSize = btn1.intrinsicContentSize()
flashMenu.buttons = [btn1, btn2, btn3]
flashMenu.views = [btn1, btn2, btn3]
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:MenuView.xcodeproj">
</FileRef>
</Workspace>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Material nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = ViewController()
window!.makeKeyAndVisible()
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Material-Icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Material-Icon-29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Material-Icon-40@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Material-Icon-40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Material-Icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Material-Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Material-Icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Material-Icon-29@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Material-Icon-40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Material-Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Material-Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Material-Icon-76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Material-Icon-83.5@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_add_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_add_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_add_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_close_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_close_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_close_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_create_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_create_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_create_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_note_add_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_note_add_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_note_add_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Material nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
This is an example of using the Menu component. It is designed to take any array
of buttons and provide a facility to animate them opened and closed as a group.
*/
import UIKit
import Material
class ViewController: UIViewController {
/// MenuView reference.
private var menuView: MenuView!
/// Default spacing size
let spacing: CGFloat = 16
/// Diameter for FabButtons.
let diameter: CGFloat = 56
/// Height for FlatButtons.
let height: CGFloat = 36
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareMenuView()
prepareMenuViewExample()
}
/// Handle orientation.
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
}
/// Handle the menuView touch event.
internal func handleMenu() {
let image: UIImage?
if menuView.menu.opened {
menuView.menu.close()
image = UIImage(named: "ic_add_white")?.imageWithRenderingMode(.AlwaysTemplate)
} else {
menuView.menu.open() { (v: UIView) in
(v as? MaterialButton)?.pulse()
}
image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate)
}
// Add a nice rotation animation to the base button.
let first: MaterialButton? = menuView.menu.views?.first as? MaterialButton
first?.animate(MaterialAnimation.rotate(1))
first?.setImage(image, forState: .Normal)
first?.setImage(image, forState: .Highlighted)
}
/// General preparation statements are placed here.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Prepares the MenuView.
private func prepareMenuView() {
if nil == menuView {
menuView = MenuView()
}
}
/// Prepares the MenuView example.
private func prepareMenuViewExample() {
var image: UIImage? = UIImage(named: "ic_add_white")?.imageWithRenderingMode(.AlwaysTemplate)
let btn1: FabButton = FabButton()
btn1.depth = .None
btn1.tintColor = MaterialColor.blue.accent3
btn1.pulseColor = nil
btn1.borderColor = MaterialColor.blue.accent3
btn1.backgroundColor = MaterialColor.white
btn1.borderWidth = 1
btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleMenu", forControlEvents: .TouchUpInside)
menuView.addSubview(btn1)
image = UIImage(named: "ic_create_white")?.imageWithRenderingMode(.AlwaysTemplate)
let btn2: FabButton = FabButton()
btn2.depth = .None
btn2.tintColor = MaterialColor.blue.accent3
btn2.pulseColor = MaterialColor.blue.accent3
btn2.borderColor = MaterialColor.blue.accent3
btn2.backgroundColor = MaterialColor.white
btn2.borderWidth = 1
btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted)
menuView.addSubview(btn2)
image = UIImage(named: "ic_photo_camera_white")?.imageWithRenderingMode(.AlwaysTemplate)
let btn3: FabButton = FabButton()
btn3.depth = .None
btn3.tintColor = MaterialColor.blue.accent3
btn3.pulseColor = MaterialColor.blue.accent3
btn3.borderColor = MaterialColor.blue.accent3
btn3.backgroundColor = MaterialColor.white
btn3.borderWidth = 1
btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted)
menuView.addSubview(btn3)
image = UIImage(named: "ic_note_add_white")?.imageWithRenderingMode(.AlwaysTemplate)
let btn4: FabButton = FabButton()
btn4.depth = .None
btn4.tintColor = MaterialColor.blue.accent3
btn4.pulseColor = MaterialColor.blue.accent3
btn4.borderColor = MaterialColor.blue.accent3
btn4.backgroundColor = MaterialColor.white
btn4.borderWidth = 1
btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted)
menuView.addSubview(btn4)
// Initialize the menu and setup the configuration options.
menuView.menu.direction = .Up
menuView.menu.baseSize = CGSizeMake(diameter, diameter)
menuView.menu.views = [btn1, btn2, btn3, btn4]
view.addSubview(menuView)
menuView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.size(view, child: menuView, width: diameter, height: diameter)
MaterialLayout.alignFromBottomLeft(view, child: menuView, bottom: 16, left: (view.bounds.width - diameter) / 2)
}
}
......@@ -81,7 +81,7 @@ class LeftViewController: UIViewController {
profileView.image = UIImage(named: "Profile9")?.resize(toWidth: 72)
profileView.shape = .Circle
profileView.borderColor = MaterialColor.white
profileView.borderWidth = .Border3
profileView.borderWidth = 3
let nameLabel: UILabel = UILabel()
nameLabel.text = "Michael Smith"
......
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '1.32.0'
s.version = '1.32.1'
s.license = 'BSD'
s.summary = 'Express your creativity with Material, an animation and graphics framework for Google\'s Material Design and Apple\'s Flat UI in Swift.'
s.homepage = 'http://cosmicmind.io'
......
......@@ -167,7 +167,7 @@ A FabButton is essential to Material Design's overall look. Below showcases its
<a name="menu"></a>
## Menu
A Menu manages a group of UIButtons that may be animated open in the Up, Down, Left, and Right directions. The animations are fully customizable. The Examples/Programmatic directory has a sample project using the Menu.
A Menu manages a group of UIViews that may be animated open in the Up, Down, Left, and Right directions. The animations are fully customizable. The Examples/Programmatic directory has sample projects using Menus.
Below is an example using FabButtons.
......@@ -248,12 +248,12 @@ Bold and attractive, ImageCardView is the next step from a CardView. Below are s
![MaterialImageCardView](http://www.cosmicmind.io/MK/MaterialImageCardView.gif)
[Learn More About ImageCardView](https://github.com/CosmicMind/Material/wiki/ImageCardView)
Remove elements, such as details to create a fresh look for your images.
![MaterialImageCardViewBackgroundImage](http://www.cosmicmind.io/MK/MaterialImageCardViewBackgroundImage.gif)
[Learn More About ImageCardView](https://github.com/CosmicMind/Material/wiki/ImageCardView)
<a name="captureview"></a>
## CaptureView
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.32.0</string>
<string>1.32.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -217,12 +217,11 @@ public class MaterialButton : UIButton {
}
/**
A property that accesses the layer.borderWith using a MaterialBorder
enum preset.
A property that accesses the layer.borderWith.
*/
public var borderWidth: MaterialBorder {
public var borderWidth: CGFloat = 0 {
didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth)
layer.borderWidth = borderWidth
}
}
......@@ -268,7 +267,6 @@ public class MaterialButton : UIButton {
- Parameter aDecoder: A NSCoder instance.
*/
public required init?(coder aDecoder: NSCoder) {
borderWidth = .None
depth = .None
shape = .None
cornerRadius = .None
......@@ -284,7 +282,6 @@ public class MaterialButton : UIButton {
- Parameter frame: A CGRect instance.
*/
public override init(frame: CGRect) {
borderWidth = .None
depth = .None
shape = .None
cornerRadius = .None
......
......@@ -260,12 +260,11 @@ public class MaterialView : UIView {
}
/**
A property that accesses the layer.borderWith using a MaterialBorder
enum preset.
A property that accesses the layer.borderWith.
*/
public var borderWidth: MaterialBorder {
public var borderWidth: CGFloat = 0 {
didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth)
layer.borderWidth = borderWidth
}
}
......@@ -305,7 +304,6 @@ public class MaterialView : UIView {
contentsCenter = CGRectMake(0, 0, 1, 1)
contentsScale = UIScreen.mainScreen().scale
contentsGravity = .ResizeAspectFill
borderWidth = .None
depth = .None
shape = .None
cornerRadius = .None
......@@ -324,7 +322,6 @@ public class MaterialView : UIView {
contentsCenter = CGRectMake(0, 0, 1, 1)
contentsScale = UIScreen.mainScreen().scale
contentsGravity = .ResizeAspectFill
borderWidth = .None
depth = .None
shape = .None
cornerRadius = .None
......
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* Copyright (C) 2015 - 20spacing, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -30,43 +30,20 @@
import UIKit
public enum MaterialBorder {
case None
case Border1
case Border2
case Border3
case Border4
case Border5
case Border6
case Border7
case Border8
case Border9
}
/**
:name: MaterialBorderToValue
*/
public func MaterialBorderToValue(border: MaterialBorder) -> CGFloat {
switch border {
case .None:
return 0
case .Border1:
return 0.5
case .Border2:
return 1
case .Border3:
return 2
case .Border4:
return 3
case .Border5:
return 4
case .Border6:
return 5
case .Border7:
return 6
case .Border8:
return 7
case .Border9:
return 8
public class MenuView : MaterialPulseView {
/// References the Menu instance.
public private(set) lazy var menu: Menu = Menu(origin: CGPointZero)
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public override func prepareView() {
super.prepareView()
pulseColor = nil
pulseScale = false
}
}
}
\ No newline at end of file
......@@ -196,12 +196,11 @@ public class TextField : UITextField {
}
/**
A property that accesses the layer.borderWith using a MaterialBorder
enum preset.
A property that accesses the layer.borderWith.
*/
public var borderWidth: MaterialBorder {
public var borderWidth: CGFloat = 0 {
didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth)
layer.borderWidth = borderWidth
}
}
......@@ -338,7 +337,6 @@ public class TextField : UITextField {
depth = .None
shape = .None
cornerRadius = .None
borderWidth = .None
super.init(coder: aDecoder)
prepareView()
}
......@@ -353,7 +351,6 @@ public class TextField : UITextField {
depth = .None
shape = .None
cornerRadius = .None
borderWidth = .None
super.init(frame: frame)
prepareView()
}
......
......@@ -198,12 +198,11 @@ public class TextView: UITextView {
}
/**
A property that accesses the layer.borderWith using a MaterialBorder
enum preset.
A property that accesses the layer.borderWith.
*/
public var borderWidth: MaterialBorder {
public var borderWidth: CGFloat = 0 {
didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth)
layer.borderWidth = borderWidth
}
}
......@@ -307,7 +306,6 @@ public class TextView: UITextView {
depth = .None
shape = .None
cornerRadius = .None
borderWidth = .None
super.init(coder: aDecoder)
prepareView()
}
......@@ -323,7 +321,6 @@ public class TextView: UITextView {
depth = .None
shape = .None
cornerRadius = .None
borderWidth = .None
super.init(frame: frame, textContainer: textContainer)
prepareView()
}
......
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