Commit d7669534 by Daniel Dahan

added MenuView, a UIView wrapper around Menu

parent 5e4d6fb5
...@@ -69,6 +69,9 @@ ...@@ -69,6 +69,9 @@
<FileRef <FileRef
location = "group:Programmatic/Menu/Menu.xcodeproj"> location = "group:Programmatic/Menu/Menu.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Programmatic/MenuView/MenuView.xcodeproj">
</FileRef>
</Group> </Group>
<Group <Group
location = "container:" location = "container:"
......
...@@ -277,7 +277,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg ...@@ -277,7 +277,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
captureButton.height = 72 captureButton.height = 72
captureButton.pulseColor = MaterialColor.white captureButton.pulseColor = MaterialColor.white
captureButton.backgroundColor = MaterialColor.red.darken1.colorWithAlphaComponent(0.3) captureButton.backgroundColor = MaterialColor.red.darken1.colorWithAlphaComponent(0.3)
captureButton.borderWidth = .Border2 captureButton.borderWidth = 2
captureButton.borderColor = MaterialColor.white captureButton.borderColor = MaterialColor.white
captureButton.depth = .None captureButton.depth = .None
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
/** /**
This is an example of using the Menu component. It is designed to take any array 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 import UIKit
...@@ -76,24 +76,23 @@ class ViewController: UIViewController { ...@@ -76,24 +76,23 @@ class ViewController: UIViewController {
/// Handle the fabMenu touch event. /// Handle the fabMenu touch event.
internal func handleFabMenu() { internal func handleFabMenu() {
// Only trigger open and close animations when enabled. let image: UIImage?
if fabMenu.enabled {
let image: UIImage? if fabMenu.opened {
if fabMenu.opened { fabMenu.close()
fabMenu.close() image = UIImage(named: "ic_add_white")
image = UIImage(named: "ic_add_white") } else {
} else { fabMenu.open() { (v: UIView) in
fabMenu.open() { (button: UIButton) in (v as? MaterialButton)?.pulse()
(button as? MaterialButton)?.pulse()
}
image = UIImage(named: "ic_close_white")
} }
image = UIImage(named: "ic_close_white")
// 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)
} }
// 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. /// Handle the flatMenu touch event.
...@@ -164,7 +163,7 @@ class ViewController: UIViewController { ...@@ -164,7 +163,7 @@ class ViewController: UIViewController {
fabMenu = Menu(origin: CGPointMake(view.bounds.width - diameter - spacing, view.bounds.height - diameter - spacing)) fabMenu = Menu(origin: CGPointMake(view.bounds.width - diameter - spacing, view.bounds.height - diameter - spacing))
fabMenu.direction = .Up fabMenu.direction = .Up
fabMenu.baseSize = CGSizeMake(diameter, diameter) fabMenu.baseSize = CGSizeMake(diameter, diameter)
fabMenu.buttons = [btn1, btn2, btn3, btn4] fabMenu.views = [btn1, btn2, btn3, btn4]
} }
/// Prepares the FlatMenu example. /// Prepares the FlatMenu example.
...@@ -181,7 +180,7 @@ class ViewController: UIViewController { ...@@ -181,7 +180,7 @@ class ViewController: UIViewController {
btn2.setTitleColor(MaterialColor.blue.accent3, forState: .Normal) btn2.setTitleColor(MaterialColor.blue.accent3, forState: .Normal)
btn2.borderColor = MaterialColor.blue.accent3 btn2.borderColor = MaterialColor.blue.accent3
btn2.pulseColor = MaterialColor.blue.accent3 btn2.pulseColor = MaterialColor.blue.accent3
btn2.borderWidth = .Border1 btn2.borderWidth = 1
btn2.setTitle("Item", forState: .Normal) btn2.setTitle("Item", forState: .Normal)
view.addSubview(btn2) view.addSubview(btn2)
...@@ -189,7 +188,7 @@ class ViewController: UIViewController { ...@@ -189,7 +188,7 @@ class ViewController: UIViewController {
btn3.setTitleColor(MaterialColor.blue.accent3, forState: .Normal) btn3.setTitleColor(MaterialColor.blue.accent3, forState: .Normal)
btn3.borderColor = MaterialColor.blue.accent3 btn3.borderColor = MaterialColor.blue.accent3
btn3.pulseColor = MaterialColor.blue.accent3 btn3.pulseColor = MaterialColor.blue.accent3
btn3.borderWidth = .Border1 btn3.borderWidth = 1
btn3.setTitle("Item", forState: .Normal) btn3.setTitle("Item", forState: .Normal)
view.addSubview(btn3) view.addSubview(btn3)
...@@ -197,7 +196,7 @@ class ViewController: UIViewController { ...@@ -197,7 +196,7 @@ class ViewController: UIViewController {
btn4.setTitleColor(MaterialColor.blue.accent3, forState: .Normal) btn4.setTitleColor(MaterialColor.blue.accent3, forState: .Normal)
btn4.borderColor = MaterialColor.blue.accent3 btn4.borderColor = MaterialColor.blue.accent3
btn4.pulseColor = MaterialColor.blue.accent3 btn4.pulseColor = MaterialColor.blue.accent3
btn4.borderWidth = .Border1 btn4.borderWidth = 1
btn4.setTitle("Item", forState: .Normal) btn4.setTitle("Item", forState: .Normal)
view.addSubview(btn4) view.addSubview(btn4)
...@@ -206,7 +205,7 @@ class ViewController: UIViewController { ...@@ -206,7 +205,7 @@ class ViewController: UIViewController {
flatMenu.direction = .Up flatMenu.direction = .Up
flatMenu.spacing = 8 flatMenu.spacing = 8
flatMenu.buttonSize = CGSizeMake(120, height) flatMenu.buttonSize = CGSizeMake(120, height)
flatMenu.buttons = [btn1, btn2, btn3, btn4] flatMenu.views = [btn1, btn2, btn3, btn4]
} }
/// Prepares the FlashMenu example. /// Prepares the FlashMenu example.
...@@ -240,7 +239,7 @@ class ViewController: UIViewController { ...@@ -240,7 +239,7 @@ class ViewController: UIViewController {
flashMenu = Menu(origin: CGPointMake((view.bounds.width + btn1.width) / 2, 100)) flashMenu = Menu(origin: CGPointMake((view.bounds.width + btn1.width) / 2, 100))
flashMenu.direction = .Left flashMenu.direction = .Left
flashMenu.buttonSize = btn1.intrinsicContentSize() flashMenu.buttonSize = btn1.intrinsicContentSize()
flashMenu.buttons = [btn1, btn2, btn3] flashMenu.views = [btn1, btn2, btn3]
} }
} }
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
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 */; };
96A71EAA1C6FC12000C0C4AE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96A71EA81C6FC12000C0C4AE /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
96A71EB41C6FC2CD00C0C4AE /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
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>"; };
96A71EA61C6FC12000C0C4AE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96A71EA91C6FC12000C0C4AE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
96A71EAB1C6FC12000C0C4AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
96A71E991C6FC12000C0C4AE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
96A71E931C6FC12000C0C4AE = {
isa = PBXGroup;
children = (
96A71E9E1C6FC12000C0C4AE /* MenuView */,
96A71E9D1C6FC12000C0C4AE /* Products */,
);
sourceTree = "<group>";
};
96A71E9D1C6FC12000C0C4AE /* Products */ = {
isa = PBXGroup;
children = (
96A71E9C1C6FC12000C0C4AE /* MenuView.app */,
);
name = Products;
sourceTree = "<group>";
};
96A71E9E1C6FC12000C0C4AE /* MenuView */ = {
isa = PBXGroup;
children = (
96A71E9F1C6FC12000C0C4AE /* AppDelegate.swift */,
96A71EA11C6FC12000C0C4AE /* ViewController.swift */,
96A71EA61C6FC12000C0C4AE /* Assets.xcassets */,
96A71EA81C6FC12000C0C4AE /* LaunchScreen.storyboard */,
96A71EAB1C6FC12000C0C4AE /* Info.plist */,
);
path = MenuView;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
96A71E9B1C6FC12000C0C4AE /* MenuView */ = {
isa = PBXNativeTarget;
buildConfigurationList = 96A71EAE1C6FC12000C0C4AE /* Build configuration list for PBXNativeTarget "MenuView" */;
buildPhases = (
96A71E981C6FC12000C0C4AE /* Sources */,
96A71E991C6FC12000C0C4AE /* Frameworks */,
96A71E9A1C6FC12000C0C4AE /* Resources */,
96A71EB41C6FC2CD00C0C4AE /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = MenuView;
productName = MenuView;
productReference = 96A71E9C1C6FC12000C0C4AE /* MenuView.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
96A71E941C6FC12000C0C4AE /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "CosmicMind, Inc.";
TargetAttributes = {
96A71E9B1C6FC12000C0C4AE = {
CreatedOnToolsVersion = 7.2;
};
};
};
buildConfigurationList = 96A71E971C6FC12000C0C4AE /* Build configuration list for PBXProject "MenuView" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 96A71E931C6FC12000C0C4AE;
productRefGroup = 96A71E9D1C6FC12000C0C4AE /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
96A71E9B1C6FC12000C0C4AE /* MenuView */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
96A71E9A1C6FC12000C0C4AE /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
96A71EAA1C6FC12000C0C4AE /* LaunchScreen.storyboard in Resources */,
96A71EA71C6FC12000C0C4AE /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
96A71E981C6FC12000C0C4AE /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
96A71EA21C6FC12000C0C4AE /* ViewController.swift in Sources */,
96A71EA01C6FC12000C0C4AE /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
96A71EA81C6FC12000C0C4AE /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
96A71EA91C6FC12000C0C4AE /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
96A71EAC1C6FC12000C0C4AE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
96A71EAD1C6FC12000C0C4AE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
96A71EAF1C6FC12000C0C4AE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = MenuView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.MenuView;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
96A71EB01C6FC12000C0C4AE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = MenuView/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.MenuView;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
96A71E971C6FC12000C0C4AE /* Build configuration list for PBXProject "MenuView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
96A71EAC1C6FC12000C0C4AE /* Debug */,
96A71EAD1C6FC12000C0C4AE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
96A71EAE1C6FC12000C0C4AE /* Build configuration list for PBXNativeTarget "MenuView" */ = {
isa = XCConfigurationList;
buildConfigurations = (
96A71EAF1C6FC12000C0C4AE /* Debug */,
96A71EB01C6FC12000C0C4AE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 96A71E941C6FC12000C0C4AE /* Project object */;
}
<?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 { ...@@ -81,7 +81,7 @@ class LeftViewController: UIViewController {
profileView.image = UIImage(named: "Profile9")?.resize(toWidth: 72) profileView.image = UIImage(named: "Profile9")?.resize(toWidth: 72)
profileView.shape = .Circle profileView.shape = .Circle
profileView.borderColor = MaterialColor.white profileView.borderColor = MaterialColor.white
profileView.borderWidth = .Border3 profileView.borderWidth = 3
let nameLabel: UILabel = UILabel() let nameLabel: UILabel = UILabel()
nameLabel.text = "Michael Smith" nameLabel.text = "Michael Smith"
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '1.32.0' s.version = '1.32.1'
s.license = 'BSD' 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.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' s.homepage = 'http://cosmicmind.io'
......
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
96442ADF1C28EF3E00C3C574 /* MaterialTableViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96442ADD1C28EF3700C3C574 /* MaterialTableViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96442ADF1C28EF3E00C3C574 /* MaterialTableViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96442ADD1C28EF3700C3C574 /* MaterialTableViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9656CD0C1C6BD33700EBCEF1 /* Grid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9656CD0B1C6BD33700EBCEF1 /* Grid.swift */; }; 9656CD0C1C6BD33700EBCEF1 /* Grid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9656CD0B1C6BD33700EBCEF1 /* Grid.swift */; };
966F57B81C226D75009185B7 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57B71C226D75009185B7 /* TextField.swift */; }; 966F57B81C226D75009185B7 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57B71C226D75009185B7 /* TextField.swift */; };
96A71E911C6FBC2200C0C4AE /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71E901C6FBC2200C0C4AE /* MenuView.swift */; };
96A71EB81C6FCFA300C0C4AE /* Material+UIImage+Color.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96DBA7351C61198400844821 /* Material+UIImage+Color.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96A71EB91C6FCFA300C0C4AE /* Grid.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9656CD0B1C6BD33700EBCEF1 /* Grid.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96A71EBA1C6FCFA300C0C4AE /* Menu.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65FDC2EA1C66858A00103AC2 /* Menu.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96A71EBB1C6FCFA300C0C4AE /* MenuView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96A71E901C6FBC2200C0C4AE /* MenuView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C1E1C1328D800B91418 /* CaptureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF51C1328D800B91418 /* CaptureView.swift */; }; 96D88C1E1C1328D800B91418 /* CaptureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF51C1328D800B91418 /* CaptureView.swift */; };
96D88C1F1C1328D800B91418 /* CardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF61C1328D800B91418 /* CardView.swift */; }; 96D88C1F1C1328D800B91418 /* CardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF61C1328D800B91418 /* CardView.swift */; };
96D88C201C1328D800B91418 /* CapturePreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF71C1328D800B91418 /* CapturePreviewView.swift */; }; 96D88C201C1328D800B91418 /* CapturePreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF71C1328D800B91418 /* CapturePreviewView.swift */; };
...@@ -44,7 +49,6 @@ ...@@ -44,7 +49,6 @@
96D88C271C1328D800B91418 /* Material+UIFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BFE1C1328D800B91418 /* Material+UIFont.swift */; }; 96D88C271C1328D800B91418 /* Material+UIFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BFE1C1328D800B91418 /* Material+UIFont.swift */; };
96D88C281C1328D800B91418 /* MaterialAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BFF1C1328D800B91418 /* MaterialAnimation.swift */; }; 96D88C281C1328D800B91418 /* MaterialAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BFF1C1328D800B91418 /* MaterialAnimation.swift */; };
96D88C291C1328D800B91418 /* MaterialBasicAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C001C1328D800B91418 /* MaterialBasicAnimation.swift */; }; 96D88C291C1328D800B91418 /* MaterialBasicAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C001C1328D800B91418 /* MaterialBasicAnimation.swift */; };
96D88C2A1C1328D800B91418 /* MaterialBorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C011C1328D800B91418 /* MaterialBorder.swift */; };
96D88C2B1C1328D800B91418 /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C021C1328D800B91418 /* MaterialButton.swift */; }; 96D88C2B1C1328D800B91418 /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C021C1328D800B91418 /* MaterialButton.swift */; };
96D88C2C1C1328D800B91418 /* MaterialColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C031C1328D800B91418 /* MaterialColor.swift */; }; 96D88C2C1C1328D800B91418 /* MaterialColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C031C1328D800B91418 /* MaterialColor.swift */; };
96D88C2D1C1328D800B91418 /* MaterialDepth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C041C1328D800B91418 /* MaterialDepth.swift */; }; 96D88C2D1C1328D800B91418 /* MaterialDepth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C041C1328D800B91418 /* MaterialDepth.swift */; };
...@@ -76,7 +80,6 @@ ...@@ -76,7 +80,6 @@
96D88C581C132ABF00B91418 /* ImageCardView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88BFB1C1328D800B91418 /* ImageCardView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96D88C581C132ABF00B91418 /* ImageCardView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88BFB1C1328D800B91418 /* ImageCardView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5A1C132ABF00B91418 /* MaterialRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C0E1C1328D800B91418 /* MaterialRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96D88C5A1C132ABF00B91418 /* MaterialRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C0E1C1328D800B91418 /* MaterialRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5B1C132ABF00B91418 /* MaterialShape.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C0F1C1328D800B91418 /* MaterialShape.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96D88C5B1C132ABF00B91418 /* MaterialShape.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C0F1C1328D800B91418 /* MaterialShape.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5C1C132ABF00B91418 /* MaterialBorder.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C011C1328D800B91418 /* MaterialBorder.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5D1C132ABF00B91418 /* MaterialColor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C031C1328D800B91418 /* MaterialColor.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96D88C5D1C132ABF00B91418 /* MaterialColor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C031C1328D800B91418 /* MaterialColor.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5E1C132ABF00B91418 /* MaterialDepth.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C041C1328D800B91418 /* MaterialDepth.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96D88C5E1C132ABF00B91418 /* MaterialDepth.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C041C1328D800B91418 /* MaterialDepth.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5F1C132ABF00B91418 /* MaterialGravity.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C061C1328D800B91418 /* MaterialGravity.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96D88C5F1C132ABF00B91418 /* MaterialGravity.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C061C1328D800B91418 /* MaterialGravity.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -133,6 +136,7 @@ ...@@ -133,6 +136,7 @@
96442ADD1C28EF3700C3C574 /* MaterialTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTableViewCell.swift; sourceTree = "<group>"; }; 96442ADD1C28EF3700C3C574 /* MaterialTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTableViewCell.swift; sourceTree = "<group>"; };
9656CD0B1C6BD33700EBCEF1 /* Grid.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Grid.swift; sourceTree = "<group>"; }; 9656CD0B1C6BD33700EBCEF1 /* Grid.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Grid.swift; sourceTree = "<group>"; };
966F57B71C226D75009185B7 /* TextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = "<group>"; }; 966F57B71C226D75009185B7 /* TextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = "<group>"; };
96A71E901C6FBC2200C0C4AE /* MenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuView.swift; sourceTree = "<group>"; };
96D88BF51C1328D800B91418 /* CaptureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureView.swift; sourceTree = "<group>"; }; 96D88BF51C1328D800B91418 /* CaptureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureView.swift; sourceTree = "<group>"; };
96D88BF61C1328D800B91418 /* CardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardView.swift; sourceTree = "<group>"; }; 96D88BF61C1328D800B91418 /* CardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardView.swift; sourceTree = "<group>"; };
96D88BF71C1328D800B91418 /* CapturePreviewView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapturePreviewView.swift; sourceTree = "<group>"; }; 96D88BF71C1328D800B91418 /* CapturePreviewView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapturePreviewView.swift; sourceTree = "<group>"; };
...@@ -145,7 +149,6 @@ ...@@ -145,7 +149,6 @@
96D88BFE1C1328D800B91418 /* Material+UIFont.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIFont.swift"; sourceTree = "<group>"; }; 96D88BFE1C1328D800B91418 /* Material+UIFont.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIFont.swift"; sourceTree = "<group>"; };
96D88BFF1C1328D800B91418 /* MaterialAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialAnimation.swift; sourceTree = "<group>"; }; 96D88BFF1C1328D800B91418 /* MaterialAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialAnimation.swift; sourceTree = "<group>"; };
96D88C001C1328D800B91418 /* MaterialBasicAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialBasicAnimation.swift; sourceTree = "<group>"; }; 96D88C001C1328D800B91418 /* MaterialBasicAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialBasicAnimation.swift; sourceTree = "<group>"; };
96D88C011C1328D800B91418 /* MaterialBorder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialBorder.swift; sourceTree = "<group>"; };
96D88C021C1328D800B91418 /* MaterialButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialButton.swift; sourceTree = "<group>"; }; 96D88C021C1328D800B91418 /* MaterialButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialButton.swift; sourceTree = "<group>"; };
96D88C031C1328D800B91418 /* MaterialColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialColor.swift; sourceTree = "<group>"; }; 96D88C031C1328D800B91418 /* MaterialColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialColor.swift; sourceTree = "<group>"; };
96D88C041C1328D800B91418 /* MaterialDepth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialDepth.swift; sourceTree = "<group>"; }; 96D88C041C1328D800B91418 /* MaterialDepth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialDepth.swift; sourceTree = "<group>"; };
...@@ -247,6 +250,15 @@ ...@@ -247,6 +250,15 @@
name = Text; name = Text;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
96A71E921C6FBC2900C0C4AE /* Menu */ = {
isa = PBXGroup;
children = (
65FDC2EA1C66858A00103AC2 /* Menu.swift */,
96A71E901C6FBC2200C0C4AE /* MenuView.swift */,
);
name = Menu;
sourceTree = "<group>";
};
96D88BF41C1328D800B91418 /* Sources */ = { 96D88BF41C1328D800B91418 /* Sources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -269,6 +281,7 @@ ...@@ -269,6 +281,7 @@
966F57B61C226D65009185B7 /* Text */, 966F57B61C226D65009185B7 /* Text */,
96442ADC1C28EF1400C3C574 /* TableView */, 96442ADC1C28EF1400C3C574 /* TableView */,
965C58BD1C6B8D3300CFB4E1 /* Grid */, 965C58BD1C6B8D3300CFB4E1 /* Grid */,
96A71E921C6FBC2900C0C4AE /* Menu */,
); );
path = Sources; path = Sources;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -310,7 +323,6 @@ ...@@ -310,7 +323,6 @@
children = ( children = (
96D88C0E1C1328D800B91418 /* MaterialRadius.swift */, 96D88C0E1C1328D800B91418 /* MaterialRadius.swift */,
96D88C0F1C1328D800B91418 /* MaterialShape.swift */, 96D88C0F1C1328D800B91418 /* MaterialShape.swift */,
96D88C011C1328D800B91418 /* MaterialBorder.swift */,
96D88C041C1328D800B91418 /* MaterialDepth.swift */, 96D88C041C1328D800B91418 /* MaterialDepth.swift */,
96D88C061C1328D800B91418 /* MaterialGravity.swift */, 96D88C061C1328D800B91418 /* MaterialGravity.swift */,
96D88C071C1328D800B91418 /* MaterialEdgeInsetPreset.swift */, 96D88C071C1328D800B91418 /* MaterialEdgeInsetPreset.swift */,
...@@ -402,7 +414,6 @@ ...@@ -402,7 +414,6 @@
96D88C541C132A7700B91418 /* Navigation */ = { 96D88C541C132A7700B91418 /* Navigation */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
65FDC2EA1C66858A00103AC2 /* Menu.swift */,
96D88C151C1328D800B91418 /* NavigationBarView.swift */, 96D88C151C1328D800B91418 /* NavigationBarView.swift */,
96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */, 96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */,
); );
...@@ -445,7 +456,6 @@ ...@@ -445,7 +456,6 @@
96D88C581C132ABF00B91418 /* ImageCardView.swift in Headers */, 96D88C581C132ABF00B91418 /* ImageCardView.swift in Headers */,
96D88C5A1C132ABF00B91418 /* MaterialRadius.swift in Headers */, 96D88C5A1C132ABF00B91418 /* MaterialRadius.swift in Headers */,
96D88C5B1C132ABF00B91418 /* MaterialShape.swift in Headers */, 96D88C5B1C132ABF00B91418 /* MaterialShape.swift in Headers */,
96D88C5C1C132ABF00B91418 /* MaterialBorder.swift in Headers */,
96D88C5D1C132ABF00B91418 /* MaterialColor.swift in Headers */, 96D88C5D1C132ABF00B91418 /* MaterialColor.swift in Headers */,
96D88C5E1C132ABF00B91418 /* MaterialDepth.swift in Headers */, 96D88C5E1C132ABF00B91418 /* MaterialDepth.swift in Headers */,
96D88C5F1C132ABF00B91418 /* MaterialGravity.swift in Headers */, 96D88C5F1C132ABF00B91418 /* MaterialGravity.swift in Headers */,
...@@ -468,6 +478,10 @@ ...@@ -468,6 +478,10 @@
960B23501C38490D00E96216 /* Text.swift in Headers */, 960B23501C38490D00E96216 /* Text.swift in Headers */,
960B23511C38490D00E96216 /* TextStorage.swift in Headers */, 960B23511C38490D00E96216 /* TextStorage.swift in Headers */,
960B23521C38490D00E96216 /* TextView.swift in Headers */, 960B23521C38490D00E96216 /* TextView.swift in Headers */,
96A71EB81C6FCFA300C0C4AE /* Material+UIImage+Color.swift in Headers */,
96A71EB91C6FCFA300C0C4AE /* Grid.swift in Headers */,
96A71EBA1C6FCFA300C0C4AE /* Menu.swift in Headers */,
96A71EBB1C6FCFA300C0C4AE /* MenuView.swift in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -584,7 +598,6 @@ ...@@ -584,7 +598,6 @@
96D88C2B1C1328D800B91418 /* MaterialButton.swift in Sources */, 96D88C2B1C1328D800B91418 /* MaterialButton.swift in Sources */,
96D88C311C1328D800B91418 /* MaterialKeyframeAnimation.swift in Sources */, 96D88C311C1328D800B91418 /* MaterialKeyframeAnimation.swift in Sources */,
96D88C2E1C1328D800B91418 /* MaterialFont.swift in Sources */, 96D88C2E1C1328D800B91418 /* MaterialFont.swift in Sources */,
96D88C2A1C1328D800B91418 /* MaterialBorder.swift in Sources */,
9656CD0C1C6BD33700EBCEF1 /* Grid.swift in Sources */, 9656CD0C1C6BD33700EBCEF1 /* Grid.swift in Sources */,
960B23461C38480E00E96216 /* Text.swift in Sources */, 960B23461C38480E00E96216 /* Text.swift in Sources */,
96D88C351C1328D800B91418 /* MaterialLayout.swift in Sources */, 96D88C351C1328D800B91418 /* MaterialLayout.swift in Sources */,
...@@ -619,6 +632,7 @@ ...@@ -619,6 +632,7 @@
96D88C461C1328D800B91418 /* SideNavigationViewController.swift in Sources */, 96D88C461C1328D800B91418 /* SideNavigationViewController.swift in Sources */,
96D88C381C1328D800B91418 /* MaterialShape.swift in Sources */, 96D88C381C1328D800B91418 /* MaterialShape.swift in Sources */,
960B23331C383EAA00E96216 /* Material+UIImage+Size.swift in Sources */, 960B23331C383EAA00E96216 /* Material+UIImage+Size.swift in Sources */,
96A71E911C6FBC2200C0C4AE /* MenuView.swift in Sources */,
96D88C271C1328D800B91418 /* Material+UIFont.swift in Sources */, 96D88C271C1328D800B91418 /* Material+UIFont.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
......
...@@ -167,7 +167,7 @@ A FabButton is essential to Material Design's overall look. Below showcases its ...@@ -167,7 +167,7 @@ A FabButton is essential to Material Design's overall look. Below showcases its
<a name="menu"></a> <a name="menu"></a>
## Menu ## 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. Below is an example using FabButtons.
...@@ -248,12 +248,12 @@ Bold and attractive, ImageCardView is the next step from a CardView. Below are s ...@@ -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) ![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. Remove elements, such as details to create a fresh look for your images.
![MaterialImageCardViewBackgroundImage](http://www.cosmicmind.io/MK/MaterialImageCardViewBackgroundImage.gif) ![MaterialImageCardViewBackgroundImage](http://www.cosmicmind.io/MK/MaterialImageCardViewBackgroundImage.gif)
[Learn More About ImageCardView](https://github.com/CosmicMind/Material/wiki/ImageCardView)
<a name="captureview"></a> <a name="captureview"></a>
## CaptureView ## CaptureView
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.32.0</string> <string>1.32.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -217,12 +217,11 @@ public class MaterialButton : UIButton { ...@@ -217,12 +217,11 @@ public class MaterialButton : UIButton {
} }
/** /**
A property that accesses the layer.borderWith using a MaterialBorder A property that accesses the layer.borderWith.
enum preset.
*/ */
public var borderWidth: MaterialBorder { public var borderWidth: CGFloat = 0 {
didSet { didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth) layer.borderWidth = borderWidth
} }
} }
...@@ -268,7 +267,6 @@ public class MaterialButton : UIButton { ...@@ -268,7 +267,6 @@ public class MaterialButton : UIButton {
- Parameter aDecoder: A NSCoder instance. - Parameter aDecoder: A NSCoder instance.
*/ */
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
borderWidth = .None
depth = .None depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
...@@ -284,7 +282,6 @@ public class MaterialButton : UIButton { ...@@ -284,7 +282,6 @@ public class MaterialButton : UIButton {
- Parameter frame: A CGRect instance. - Parameter frame: A CGRect instance.
*/ */
public override init(frame: CGRect) { public override init(frame: CGRect) {
borderWidth = .None
depth = .None depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
......
...@@ -260,12 +260,11 @@ public class MaterialView : UIView { ...@@ -260,12 +260,11 @@ public class MaterialView : UIView {
} }
/** /**
A property that accesses the layer.borderWith using a MaterialBorder A property that accesses the layer.borderWith.
enum preset.
*/ */
public var borderWidth: MaterialBorder { public var borderWidth: CGFloat = 0 {
didSet { didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth) layer.borderWidth = borderWidth
} }
} }
...@@ -305,7 +304,6 @@ public class MaterialView : UIView { ...@@ -305,7 +304,6 @@ public class MaterialView : UIView {
contentsCenter = CGRectMake(0, 0, 1, 1) contentsCenter = CGRectMake(0, 0, 1, 1)
contentsScale = UIScreen.mainScreen().scale contentsScale = UIScreen.mainScreen().scale
contentsGravity = .ResizeAspectFill contentsGravity = .ResizeAspectFill
borderWidth = .None
depth = .None depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
...@@ -324,7 +322,6 @@ public class MaterialView : UIView { ...@@ -324,7 +322,6 @@ public class MaterialView : UIView {
contentsCenter = CGRectMake(0, 0, 1, 1) contentsCenter = CGRectMake(0, 0, 1, 1)
contentsScale = UIScreen.mainScreen().scale contentsScale = UIScreen.mainScreen().scale
contentsGravity = .ResizeAspectFill contentsGravity = .ResizeAspectFill
borderWidth = .None
depth = .None depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
......
...@@ -48,7 +48,7 @@ public class Menu { ...@@ -48,7 +48,7 @@ public class Menu {
} }
} }
/// The space between buttons. /// The space between views.
public var spacing: CGFloat { public var spacing: CGFloat {
didSet { didSet {
reloadLayout() reloadLayout()
...@@ -65,14 +65,14 @@ public class Menu { ...@@ -65,14 +65,14 @@ public class Menu {
} }
} }
/// An Array of UIButtons. /// An Array of UIViews.
public var buttons: Array<UIButton>? { public var views: Array<UIView>? {
didSet { didSet {
reloadLayout() reloadLayout()
} }
} }
/// Size of buttons, not including the first button. /// Size of views, not including the first button.
public var buttonSize: CGSize = CGSizeMake(48, 48) public var buttonSize: CGSize = CGSizeMake(48, 48)
/// An Optional base button size. /// An Optional base button size.
...@@ -81,7 +81,7 @@ public class Menu { ...@@ -81,7 +81,7 @@ public class Menu {
/** /**
Initializer. Initializer.
- Parameter origin: The origin position of the Menu. - Parameter origin: The origin position of the Menu.
- Parameter spacing: The spacing size between buttons. - Parameter spacing: The spacing size between views.
*/ */
public init(origin: CGPoint, spacing: CGFloat = 16) { public init(origin: CGPoint, spacing: CGFloat = 16) {
self.origin = origin self.origin = origin
...@@ -104,7 +104,7 @@ public class Menu { ...@@ -104,7 +104,7 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
public func open(duration duration: NSTimeInterval = 0.15, delay: NSTimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIButton) -> Void)? = nil, completion: ((UIButton) -> Void)? = nil) { public func open(duration duration: NSTimeInterval = 0.15, delay: NSTimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
if enabled { if enabled {
disable() disable()
switch direction { switch direction {
...@@ -130,7 +130,7 @@ public class Menu { ...@@ -130,7 +130,7 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
public func close(duration duration: NSTimeInterval = 0.15, delay: NSTimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIButton) -> Void)? = nil, completion: ((UIButton) -> Void)? = nil) { public func close(duration duration: NSTimeInterval = 0.15, delay: NSTimeInterval = 0, usingSpringWithDamping: CGFloat = 0.5, initialSpringVelocity: CGFloat = 0, options: UIViewAnimationOptions = [], animations: ((UIView) -> Void)? = nil, completion: ((UIView) -> Void)? = nil) {
if enabled { if enabled {
disable() disable()
switch direction { switch direction {
...@@ -156,14 +156,14 @@ public class Menu { ...@@ -156,14 +156,14 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
private func openUpAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIButton) -> Void)?, completion: ((UIButton) -> Void)?) { private func openUpAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
var base: UIButton? var base: UIView?
for var i: Int = 1, l: Int = v.count; i < l; ++i { for var i: Int = 1, l: Int = v.count; i < l; ++i {
if nil == base { if nil == base {
base = v[0] base = v[0]
} }
let button: UIButton = v[i] let button: UIView = v[i]
button.hidden = false button.hidden = false
UIView.animateWithDuration(Double(i) * duration, UIView.animateWithDuration(Double(i) * duration,
...@@ -194,10 +194,10 @@ public class Menu { ...@@ -194,10 +194,10 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
public func closeUpAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIButton) -> Void)?, completion: ((UIButton) -> Void)?) { public func closeUpAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
for var i: Int = 1, l: Int = v.count; i < l; ++i { for var i: Int = 1, l: Int = v.count; i < l; ++i {
let button: UIButton = v[i] let button: UIView = v[i]
UIView.animateWithDuration(Double(i) * duration, UIView.animateWithDuration(Double(i) * duration,
delay: delay, delay: delay,
...@@ -228,15 +228,15 @@ public class Menu { ...@@ -228,15 +228,15 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
private func openDownAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIButton) -> Void)?, completion: ((UIButton) -> Void)?) { private func openDownAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
var base: UIButton? var base: UIView?
for var i: Int = 1, l: Int = v.count; i < l; ++i { for var i: Int = 1, l: Int = v.count; i < l; ++i {
if nil == base { if nil == base {
base = v[0] base = v[0]
} }
let button: UIButton = v[i] let button: UIView = v[i]
button.hidden = false button.hidden = false
let h: CGFloat = nil == baseSize ? buttonSize.height : baseSize!.height let h: CGFloat = nil == baseSize ? buttonSize.height : baseSize!.height
...@@ -268,10 +268,10 @@ public class Menu { ...@@ -268,10 +268,10 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
public func closeDownAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIButton) -> Void)?, completion: ((UIButton) -> Void)?) { public func closeDownAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
for var i: Int = 1, l: Int = v.count; i < l; ++i { for var i: Int = 1, l: Int = v.count; i < l; ++i {
let button: UIButton = v[i] let button: UIView = v[i]
let h: CGFloat = nil == baseSize ? buttonSize.height : baseSize!.height let h: CGFloat = nil == baseSize ? buttonSize.height : baseSize!.height
UIView.animateWithDuration(Double(i) * duration, UIView.animateWithDuration(Double(i) * duration,
...@@ -303,15 +303,15 @@ public class Menu { ...@@ -303,15 +303,15 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
private func openLeftAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIButton) -> Void)?, completion: ((UIButton) -> Void)?) { private func openLeftAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
var base: UIButton? var base: UIView?
for var i: Int = 1, l: Int = v.count; i < l; ++i { for var i: Int = 1, l: Int = v.count; i < l; ++i {
if nil == base { if nil == base {
base = v[0] base = v[0]
} }
let button: UIButton = v[i] let button: UIView = v[i]
button.hidden = false button.hidden = false
UIView.animateWithDuration(Double(i) * duration, UIView.animateWithDuration(Double(i) * duration,
...@@ -342,10 +342,10 @@ public class Menu { ...@@ -342,10 +342,10 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
public func closeLeftAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIButton) -> Void)?, completion: ((UIButton) -> Void)?) { public func closeLeftAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
for var i: Int = 1, l: Int = v.count; i < l; ++i { for var i: Int = 1, l: Int = v.count; i < l; ++i {
let button: UIButton = v[i] let button: UIView = v[i]
UIView.animateWithDuration(Double(i) * duration, UIView.animateWithDuration(Double(i) * duration,
delay: delay, delay: delay,
usingSpringWithDamping: usingSpringWithDamping, usingSpringWithDamping: usingSpringWithDamping,
...@@ -375,14 +375,14 @@ public class Menu { ...@@ -375,14 +375,14 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
private func openRightAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIButton) -> Void)?, completion: ((UIButton) -> Void)?) { private func openRightAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
var base: UIButton? var base: UIView?
for var i: Int = 1, l: Int = v.count; i < l; ++i { for var i: Int = 1, l: Int = v.count; i < l; ++i {
if nil == base { if nil == base {
base = v[0] base = v[0]
} }
let button: UIButton = v[i] let button: UIView = v[i]
button.hidden = false button.hidden = false
let h: CGFloat = nil == baseSize ? buttonSize.height : baseSize!.height let h: CGFloat = nil == baseSize ? buttonSize.height : baseSize!.height
...@@ -414,10 +414,10 @@ public class Menu { ...@@ -414,10 +414,10 @@ public class Menu {
- Parameter animations: An animation block to execute on each button's animation. - Parameter animations: An animation block to execute on each button's animation.
- Parameter completion: A completion block to execute on each button's animation. - Parameter completion: A completion block to execute on each button's animation.
*/ */
public func closeRightAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIButton) -> Void)?, completion: ((UIButton) -> Void)?) { public func closeRightAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
for var i: Int = 1, l: Int = v.count; i < l; ++i { for var i: Int = 1, l: Int = v.count; i < l; ++i {
let button: UIButton = v[i] let button: UIView = v[i]
let w: CGFloat = nil == baseSize ? buttonSize.width : baseSize!.width let w: CGFloat = nil == baseSize ? buttonSize.width : baseSize!.width
UIView.animateWithDuration(Double(i) * duration, UIView.animateWithDuration(Double(i) * duration,
...@@ -439,12 +439,12 @@ public class Menu { ...@@ -439,12 +439,12 @@ public class Menu {
} }
} }
/// Layout the buttons. /// Layout the views.
private func layoutButtons() { private func layoutButtons() {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
let size: CGSize = nil == baseSize ? buttonSize : baseSize! let size: CGSize = nil == baseSize ? buttonSize : baseSize!
for var i: Int = 0, l: Int = v.count; i < l; ++i { for var i: Int = 0, l: Int = v.count; i < l; ++i {
let button: UIButton = v[i] let button: UIView = v[i]
if 0 == i { if 0 == i {
button.frame.size = size button.frame.size = size
button.frame.origin = origin button.frame.origin = origin
...@@ -461,9 +461,9 @@ public class Menu { ...@@ -461,9 +461,9 @@ public class Menu {
} }
} }
/// Disable the Menu if buttons exist. /// Disable the Menu if views exist.
private func disable() { private func disable() {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
if 0 < v.count { if 0 < v.count {
enabled = false enabled = false
} }
...@@ -472,10 +472,10 @@ public class Menu { ...@@ -472,10 +472,10 @@ public class Menu {
/** /**
Enable the Menu if the last button is equal to the passed in button. Enable the Menu if the last button is equal to the passed in button.
- Parameter button: UIButton that is passed in to compare. - Parameter button: UIView that is passed in to compare.
*/ */
private func enable(button: UIButton) { private func enable(button: UIView) {
if let v: Array<UIButton> = buttons { if let v: Array<UIView> = views {
if button == v.last { if button == v.last {
enabled = true enabled = true
} }
......
/* /*
* 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. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -30,43 +30,20 @@ ...@@ -30,43 +30,20 @@
import UIKit import UIKit
public enum MaterialBorder { public class MenuView : MaterialPulseView {
case None /// References the Menu instance.
case Border1 public private(set) lazy var menu: Menu = Menu(origin: CGPointZero)
case Border2
case Border3 /**
case Border4 Prepares the view instance when intialized. When subclassing,
case Border5 it is recommended to override the prepareView method
case Border6 to initialize property values and other setup operations.
case Border7 The super.prepareView method should always be called immediately
case Border8 when subclassing.
case Border9 */
} public override func prepareView() {
super.prepareView()
/** pulseColor = nil
:name: MaterialBorderToValue pulseScale = false
*/
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
} }
} }
\ No newline at end of file
...@@ -196,12 +196,11 @@ public class TextField : UITextField { ...@@ -196,12 +196,11 @@ public class TextField : UITextField {
} }
/** /**
A property that accesses the layer.borderWith using a MaterialBorder A property that accesses the layer.borderWith.
enum preset.
*/ */
public var borderWidth: MaterialBorder { public var borderWidth: CGFloat = 0 {
didSet { didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth) layer.borderWidth = borderWidth
} }
} }
...@@ -338,7 +337,6 @@ public class TextField : UITextField { ...@@ -338,7 +337,6 @@ public class TextField : UITextField {
depth = .None depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
borderWidth = .None
super.init(coder: aDecoder) super.init(coder: aDecoder)
prepareView() prepareView()
} }
...@@ -353,7 +351,6 @@ public class TextField : UITextField { ...@@ -353,7 +351,6 @@ public class TextField : UITextField {
depth = .None depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
borderWidth = .None
super.init(frame: frame) super.init(frame: frame)
prepareView() prepareView()
} }
......
...@@ -198,12 +198,11 @@ public class TextView: UITextView { ...@@ -198,12 +198,11 @@ public class TextView: UITextView {
} }
/** /**
A property that accesses the layer.borderWith using a MaterialBorder A property that accesses the layer.borderWith.
enum preset.
*/ */
public var borderWidth: MaterialBorder { public var borderWidth: CGFloat = 0 {
didSet { didSet {
layer.borderWidth = MaterialBorderToValue(borderWidth) layer.borderWidth = borderWidth
} }
} }
...@@ -307,7 +306,6 @@ public class TextView: UITextView { ...@@ -307,7 +306,6 @@ public class TextView: UITextView {
depth = .None depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
borderWidth = .None
super.init(coder: aDecoder) super.init(coder: aDecoder)
prepareView() prepareView()
} }
...@@ -323,7 +321,6 @@ public class TextView: UITextView { ...@@ -323,7 +321,6 @@ public class TextView: UITextView {
depth = .None depth = .None
shape = .None shape = .None
cornerRadius = .None cornerRadius = .None
borderWidth = .None
super.init(frame: frame, textContainer: textContainer) super.init(frame: frame, textContainer: textContainer)
prepareView() 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