Commit a8c2438b by Daniel Dahan

fixed issue-323 and issue-333

parent eafb089b
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
location = "group:Programmatic/FilterBlur/FilterBlur.xcodeproj"> location = "group:Programmatic/FilterBlur/FilterBlur.xcodeproj">
</FileRef> </FileRef>
<FileRef <FileRef
location = "group:Programmatic/MaterialDepth/MaterialDepth.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/MaterialLayer/MaterialLayer.xcodeproj"> location = "group:Programmatic/MaterialLayer/MaterialLayer.xcodeproj">
</FileRef> </FileRef>
<FileRef <FileRef
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:MaterialDepth.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 {
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
<?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>
<string>UIInterfaceOrientationPortraitUpsideDown</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.
*/
import UIKit
import Material
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareMaterialDepth()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Prepares the MaterialDepth.
private func prepareMaterialDepth() {
let v1: MaterialView = MaterialView()
v1.translatesAutoresizingMaskIntoConstraints = false
v1.depth = .Depth1
view.addSubview(v1)
let v2: MaterialView = MaterialView()
v2.translatesAutoresizingMaskIntoConstraints = false
v2.depth = .Depth2
view.addSubview(v2)
let v3: MaterialView = MaterialView()
v3.translatesAutoresizingMaskIntoConstraints = false
v3.depth = .Depth3
view.addSubview(v3)
let v4: MaterialView = MaterialView()
v4.translatesAutoresizingMaskIntoConstraints = false
v4.depth = .Depth4
view.addSubview(v4)
let v5: MaterialView = MaterialView()
v5.translatesAutoresizingMaskIntoConstraints = false
v5.depth = .Depth5
view.addSubview(v5)
let children: Array<UIView> = [v1, v2, v3, v4, v5]
// Align the vs vertically with an equal height.
MaterialLayout.alignToParentVertically(view, children: children, top: 100, bottom: 100, spacing: 20)
/*
Individually set the vs' horizontal alignment.
If this is left out, the intrinsic value is used for the view.
*/
for v in children {
MaterialLayout.alignToParentHorizontally(view, child: v, left: 20, right: 20)
}
}
}
...@@ -42,7 +42,7 @@ class ViewController: UIViewController { ...@@ -42,7 +42,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareGeneralMaterialViewExample() prepareMaterialView()
} }
/// General preparation statements. /// General preparation statements.
...@@ -50,8 +50,8 @@ class ViewController: UIViewController { ...@@ -50,8 +50,8 @@ class ViewController: UIViewController {
view.backgroundColor = MaterialColor.white view.backgroundColor = MaterialColor.white
} }
/// Prepare the MaterialView. /// Prepares the MaterialView.
private func prepareGeneralMaterialViewExample() { private func prepareMaterialView() {
let diameter: CGFloat = 150 let diameter: CGFloat = 150
let point: CGFloat = (MaterialDevice.width - diameter) / 2 let point: CGFloat = (MaterialDevice.width - diameter) / 2
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_edit_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_edit_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_edit_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"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--View Controller--> <!--View Controller-->
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="g8F-Xx-oIC" customClass="RaisedButton" customModule="Material"> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" reversesTitleShadowWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="g8F-Xx-oIC" customClass="RaisedButton" customModule="Material">
<rect key="frame" x="107" y="207" width="200" height="65"/> <rect key="frame" x="107" y="207" width="200" height="65"/>
<state key="normal" title="Button"/> <state key="normal" title="Button"/>
</button> </button>
......
...@@ -69,10 +69,10 @@ class ViewController: UIViewController { ...@@ -69,10 +69,10 @@ class ViewController: UIViewController {
:description: General preparation statements. :description: General preparation statements.
*/ */
func prepareFabButtonExample() { func prepareFabButtonExample() {
let img: UIImage? = UIImage(named: "ic_edit_white") let img: UIImage? = MaterialIcon.cm.edit
fabButton.setImage(img, forState: .Normal) fabButton.setImage(img, forState: .Normal)
fabButton.setImage(img, forState: .Highlighted) fabButton.setImage(img, forState: .Highlighted)
fabButton.tintColor = UIColor.whiteColor() fabButton.tintColor = MaterialColor.white
} }
} }
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '1.39.16' s.version = '1.39.17'
s.license = 'BSD' s.license = 'BSD'
s.summary = 'An animation and graphics framework for Material Design in Swift.' s.summary = 'An animation and graphics framework for Material Design in Swift.'
s.homepage = 'http://cosmicmind.io' s.homepage = 'http://cosmicmind.io'
......
...@@ -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.39.16</string> <string>1.39.17</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -40,8 +40,8 @@ public class FabButton : MaterialButton { ...@@ -40,8 +40,8 @@ public class FabButton : MaterialButton {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
backgroundColor = MaterialColor.red.darken1
depth = .Depth1 depth = .Depth1
shape = .Circle shape = .Circle
backgroundColor = MaterialColor.red.darken1
} }
} }
\ No newline at end of file
...@@ -40,9 +40,8 @@ public class FlatButton : MaterialButton { ...@@ -40,9 +40,8 @@ public class FlatButton : MaterialButton {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
setTitleColor(MaterialColor.blue.accent3, forState: .Normal)
pulseColor = MaterialColor.blue.accent3
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .Radius1
contentEdgeInsetsPreset = .WideRectangle3 contentEdgeInsetsPreset = .WideRectangle3
pulseColor = MaterialColor.blue.accent3
} }
} }
\ No newline at end of file
...@@ -47,14 +47,14 @@ public func MaterialDepthToValue(depth: MaterialDepth) -> MaterialDepthType { ...@@ -47,14 +47,14 @@ public func MaterialDepthToValue(depth: MaterialDepth) -> MaterialDepthType {
case .None: case .None:
return (offset: CGSizeZero, opacity: 0, radius: 0) return (offset: CGSizeZero, opacity: 0, radius: 0)
case .Depth1: case .Depth1:
return (offset: CGSizeMake(0.2, 0.2), opacity: 0.5, radius: 1) return (offset: CGSizeMake(0, 1), opacity: 0.3, radius: 1)
case .Depth2: case .Depth2:
return (offset: CGSizeMake(0.4, 0.4), opacity: 0.5, radius: 2) return (offset: CGSizeMake(0, 2), opacity: 0.3, radius: 2)
case .Depth3: case .Depth3:
return (offset: CGSizeMake(0.6, 0.6), opacity: 0.5, radius: 3) return (offset: CGSizeMake(0, 3), opacity: 0.3, radius: 3)
case .Depth4: case .Depth4:
return (offset: CGSizeMake(0.8, 0.8), opacity: 0.5, radius: 4) return (offset: CGSizeMake(0, 4), opacity: 0.3, radius: 4)
case .Depth5: case .Depth5:
return (offset: CGSizeMake(1, 1), opacity: 0.5, radius: 5) return (offset: CGSizeMake(0, 5), opacity: 0.3, radius: 5)
} }
} }
...@@ -40,10 +40,10 @@ public class RaisedButton : MaterialButton { ...@@ -40,10 +40,10 @@ public class RaisedButton : MaterialButton {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
setTitleColor(MaterialColor.white, forState: .Normal)
backgroundColor = MaterialColor.blue.accent3
depth = .Depth1 depth = .Depth1
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .Radius1
contentEdgeInsetsPreset = .WideRectangle3 contentEdgeInsetsPreset = .WideRectangle3
backgroundColor = MaterialColor.white
pulseColor = MaterialColor.blue.accent3
} }
} }
\ No newline at end of file
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