Commit d6db0226 by Daniel Dahan

prepare for release with deprecated iOS 9 status bar style and status bar hidden

parent 672c9486
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
name = "Programmatic"> name = "Programmatic">
<Group <Group
location = "container:" location = "container:"
name = "MaterialLayout">
<FileRef
location = "group:Programmatic/MaterialLayout/MaterialLayout.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"
name = "MaterialLayer"> name = "MaterialLayer">
<FileRef <FileRef
location = "group:Programmatic/MaterialLayer/MaterialLayer.xcodeproj"> location = "group:Programmatic/MaterialLayer/MaterialLayer.xcodeproj">
......
...@@ -40,8 +40,8 @@ class ViewController: UIViewController { ...@@ -40,8 +40,8 @@ class ViewController: UIViewController {
// Examples of using ImageCardView. // Examples of using ImageCardView.
// Uncomment different examples and read // Uncomment different examples and read
// the comments below. // the comments below.
prepareGeneralImageCardViewExample() // prepareGeneralImageCardViewExample()
// prepareImageCardViewWithoutDetailLabelAndDividerExample() prepareImageCardViewWithoutDetailLabelAndDividerExample()
} }
/** /**
...@@ -121,7 +121,7 @@ class ViewController: UIViewController { ...@@ -121,7 +121,7 @@ class ViewController: UIViewController {
titleLabel.font = RobotoFont.regularWithSize(24) titleLabel.font = RobotoFont.regularWithSize(24)
imageCardView.titleLabel = titleLabel imageCardView.titleLabel = titleLabel
imageCardView.titleLabelInsetsRef.top = 80 imageCardView.titleLabelInsetsRef.top = 80
// Star button. // Star button.
let img1: UIImage? = UIImage(named: "ic_star_grey_darken_2") let img1: UIImage? = UIImage(named: "ic_star_grey_darken_2")
let btn1: FlatButton = FlatButton() let btn1: FlatButton = FlatButton()
...@@ -130,7 +130,7 @@ class ViewController: UIViewController { ...@@ -130,7 +130,7 @@ class ViewController: UIViewController {
btn1.pulseScale = false btn1.pulseScale = false
btn1.setImage(img1, forState: .Normal) btn1.setImage(img1, forState: .Normal)
btn1.setImage(img1, forState: .Highlighted) btn1.setImage(img1, forState: .Highlighted)
// Favorite button. // Favorite button.
let img2: UIImage? = UIImage(named: "ic_favorite_grey_darken_2") let img2: UIImage? = UIImage(named: "ic_favorite_grey_darken_2")
let btn2: FlatButton = FlatButton() let btn2: FlatButton = FlatButton()
...@@ -150,7 +150,7 @@ class ViewController: UIViewController { ...@@ -150,7 +150,7 @@ class ViewController: UIViewController {
btn3.setImage(img3, forState: .Highlighted) btn3.setImage(img3, forState: .Highlighted)
// Add buttons to right side. // Add buttons to right side.
imageCardView.rightButtons = [btn1, btn2, btn3] imageCardView.rightButtons = [btn1]
imageCardView.rightButtonsInsetsRef.top = imageCardView.contentInsetsRef.top imageCardView.rightButtonsInsetsRef.top = imageCardView.contentInsetsRef.top
// To support orientation changes, use MaterialLayout. // To support orientation changes, use MaterialLayout.
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:MaterialLayout.xcodeproj">
</FileRef>
</Workspace>
//
// Copyright (C) 2015 CosmicMind, Inc. <http://cosmicmind.io> and other CosmicMind contributors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
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" : "Icon-29@2x-1.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-40@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76@2x.png",
"scale" : "2x"
}
],
"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 CosmicMind, Inc. <http://cosmicmind.io> and other CosmicMind contributors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import UIKit
import MaterialKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
// Examples of using MaterialLayout.
prepareAlignCollectionToParentHorizontallyExample()
}
/**
:name: prepareView
:description: General preparation statements.
*/
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/**
:name: prepareAlignCollectionToParentHorizontallyExample
:description: General usage example.
*/
private func prepareAlignCollectionToParentHorizontallyExample() {
let view1: MaterialView = MaterialView()
view1.translatesAutoresizingMaskIntoConstraints = false
view1.backgroundColor = MaterialColor.blueGrey.base
view.addSubview(view1)
let view2: MaterialView = MaterialView()
view2.translatesAutoresizingMaskIntoConstraints = false
view2.backgroundColor = MaterialColor.blueGrey.darken1
view.addSubview(view2)
let view3: MaterialView = MaterialView()
view3.translatesAutoresizingMaskIntoConstraints = false
view3.backgroundColor = MaterialColor.blueGrey.darken2
view.addSubview(view3)
let view4: MaterialView = MaterialView()
view4.translatesAutoresizingMaskIntoConstraints = false
view4.backgroundColor = MaterialColor.blueGrey.darken3
view.addSubview(view4)
let view5: MaterialView = MaterialView()
view5.translatesAutoresizingMaskIntoConstraints = false
view5.backgroundColor = MaterialColor.blueGrey.darken4
view.addSubview(view5)
// let children: Array<UIView> = [view1, view2, view3, view4, view5]
// MaterialLayout.alignChildrenToParentHorizontally(view, children: children, left: 10, right: 10, options: [NSLayoutFormatOptions.AlignAllCenterX])
// for v in children {
// MaterialLayout.height(view, child: v, height: 100)
// }
}
}
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'MK' s.name = 'MK'
s.version = '1.24.8' s.version = '1.24.9'
s.license = { :type => "AGPL-3.0", :file => "LICENSE" } s.license = { :type => "AGPL-3.0", :file => "LICENSE" }
s.summary = 'Beautiful Material Design in Swift.' s.summary = 'Beautiful Material Design in Swift.'
s.homepage = 'http://materialkit.io' s.homepage = 'http://materialkit.io'
......
...@@ -332,8 +332,8 @@ ...@@ -332,8 +332,8 @@
96D88C531C132A6900B91418 /* View */ = { 96D88C531C132A6900B91418 /* View */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96D88C0D1C1328D800B91418 /* MaterialPulseView.swift */,
96D88C141C1328D800B91418 /* MaterialView.swift */, 96D88C141C1328D800B91418 /* MaterialView.swift */,
96D88C0D1C1328D800B91418 /* MaterialPulseView.swift */,
); );
name = View; name = View;
sourceTree = "<group>"; sourceTree = "<group>";
......
...@@ -236,12 +236,12 @@ public class CardView : MaterialPulseView { ...@@ -236,12 +236,12 @@ public class CardView : MaterialPulseView {
if divider { if divider {
var y: CGFloat = contentInsetsRef.bottom + dividerInsetsRef.bottom var y: CGFloat = contentInsetsRef.bottom + dividerInsetsRef.bottom
if 0 < leftButtons?.count { if 0 < leftButtons?.count {
y += leftButtonsInsetsRef.top + leftButtonsInsetsRef.bottom + leftButtons![0].frame.size.height y += leftButtonsInsetsRef.top + leftButtonsInsetsRef.bottom + leftButtons![0].frame.height
} else if 0 < rightButtons?.count { } else if 0 < rightButtons?.count {
y += rightButtonsInsetsRef.top + rightButtonsInsetsRef.bottom + rightButtons![0].frame.size.height y += rightButtonsInsetsRef.top + rightButtonsInsetsRef.bottom + rightButtons![0].frame.height
} }
if 0 < y { if 0 < y {
prepareDivider(bounds.size.height - y - 0.5, width: bounds.size.width) prepareDivider(bounds.height - y - 0.5, width: bounds.width)
} }
} else { } else {
dividerLayer?.removeFromSuperlayer() dividerLayer?.removeFromSuperlayer()
......
...@@ -22,7 +22,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -22,7 +22,7 @@ public class ImageCardView : MaterialPulseView {
// //
// :name: dividerLayer // :name: dividerLayer
// //
internal var dividerLayer: CAShapeLayer? private var dividerLayer: CAShapeLayer?
// //
// :name: dividerColor // :name: dividerColor
...@@ -324,18 +324,18 @@ public class ImageCardView : MaterialPulseView { ...@@ -324,18 +324,18 @@ public class ImageCardView : MaterialPulseView {
super.layoutSublayersOfLayer(layer) super.layoutSublayersOfLayer(layer)
if self.layer == layer { if self.layer == layer {
// image // image
imageLayer?.frame.size.width = bounds.size.width imageLayer?.frame.size.width = bounds.width
// divider // divider
if divider { if divider {
var y: CGFloat = contentInsetsRef.bottom + dividerInsetsRef.bottom var y: CGFloat = contentInsetsRef.bottom + dividerInsetsRef.bottom
if 0 < leftButtons?.count { if 0 < leftButtons?.count {
y += leftButtonsInsetsRef.top + leftButtonsInsetsRef.bottom + leftButtons![0].frame.size.height y += leftButtonsInsetsRef.top + leftButtonsInsetsRef.bottom + leftButtons![0].frame.height
} else if 0 < rightButtons?.count { } else if 0 < rightButtons?.count {
y += rightButtonsInsetsRef.top + rightButtonsInsetsRef.bottom + rightButtons![0].frame.size.height y += rightButtonsInsetsRef.top + rightButtonsInsetsRef.bottom + rightButtons![0].frame.height
} }
if 0 < y { if 0 < y {
prepareDivider(bounds.size.height - y - 0.5, width: bounds.size.width) prepareDivider(bounds.height - y - 0.5, width: bounds.width)
} }
} else { } else {
dividerLayer?.removeFromSuperlayer() dividerLayer?.removeFromSuperlayer()
...@@ -381,7 +381,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -381,7 +381,7 @@ public class ImageCardView : MaterialPulseView {
if nil != imageLayer?.contents { if nil != imageLayer?.contents {
verticalFormat += "-(insetTop)" verticalFormat += "-(insetTop)"
metrics["insetTop"] = imageLayer?.frame.size.height metrics["insetTop"] = contentInsetsRef.top + imageLayer!.frame.height
} else if nil != titleLabel { } else if nil != titleLabel {
verticalFormat += "-(insetTop)" verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInsetsRef.top + titleLabelInsetsRef.top metrics["insetTop"] = contentInsetsRef.top + titleLabelInsetsRef.top
...@@ -521,7 +521,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -521,7 +521,7 @@ public class ImageCardView : MaterialPulseView {
} else { } else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailLabelInsetsRef.bottom + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0) metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailLabelInsetsRef.bottom + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
} }
} else if nil == detailLabel { } else {
if 0 < leftButtons?.count { if 0 < leftButtons?.count {
verticalFormat += "-[button]" verticalFormat += "-[button]"
views["button"] = leftButtons![0] views["button"] = leftButtons![0]
......
...@@ -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.24.8</string> <string>1.24.9</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -22,47 +22,81 @@ public struct MaterialLayout { ...@@ -22,47 +22,81 @@ public struct MaterialLayout {
/** /**
:name: width :name: width
*/ */
public static func width(parent: UIView, child: UIView, width: CGFloat = 0) { public static func width(parent: UIView, child: UIView, width: CGFloat = 0, options: NSLayoutFormatOptions = []) {
let metrics: Dictionary<String, AnyObject> = ["width" : width] let metrics: Dictionary<String, AnyObject> = ["width" : width]
let views: Dictionary<String, AnyObject> = ["child" : child] let views: Dictionary<String, AnyObject> = ["child" : child]
parent.addConstraints(constraint("H:[child(width)]", options: [], metrics: metrics, views: views)) parent.addConstraints(constraint("H:[child(width)]", options: options, metrics: metrics, views: views))
} }
/** /**
:name: height :name: height
*/ */
public static func height(parent: UIView, child: UIView, height: CGFloat = 0) { public static func height(parent: UIView, child: UIView, height: CGFloat = 0, options: NSLayoutFormatOptions = []) {
let metrics: Dictionary<String, AnyObject> = ["height" : height] let metrics: Dictionary<String, AnyObject> = ["height" : height]
let views: Dictionary<String, AnyObject> = ["child" : child] let views: Dictionary<String, AnyObject> = ["child" : child]
parent.addConstraints(constraint("V:[child(height)]", options: [], metrics: metrics, views: views)) parent.addConstraints(constraint("V:[child(height)]", options: options, metrics: metrics, views: views))
} }
/** /**
:name: size :name: size
*/ */
public static func size(parent: UIView, child: UIView, width: CGFloat = 0, height: CGFloat = 0) { public static func size(parent: UIView, child: UIView, width: CGFloat = 0, height: CGFloat = 0, options: NSLayoutFormatOptions = []) {
MaterialLayout.width(parent, child: child, width: width) MaterialLayout.width(parent, child: child, width: width)
MaterialLayout.height(parent, child: child, height: height) MaterialLayout.height(parent, child: child, height: height)
} }
// /**
// :name: alignChildrenToParentHorizontally
// */
// public static func alignChildrenToParentHorizontally(parent: UIView, children: Array<UIView>, left: CGFloat = 0, right: CGFloat = 0, minimumInteritemSpacing: CGFloat = 0, options: NSLayoutFormatOptions = []) {
// if 0 < children.count {
// var format: String = "H:"
// var i: Int = 1
// var views: Dictionary<String, UIView> = Dictionary<String, UIView>()
// for v in children {
// let k: String = "view\(i++)"
// views[k] = v
// format += i > children.count ? "[\(k)]" : "[\(k)]"
// }
// print(format)
// parent.addConstraints(constraint(format, options: options, metrics: ["left" : left, "right": right, "minimumInteritemSpacing": minimumInteritemSpacing], views: views))
// }
// }
//
// /**
// :name: alignChildrenToParentVertically
// */
// public static func alignChildrenToParentVertically(parent: UIView, children: Array<UIView>, top: CGFloat = 0, bottom: CGFloat = 0, minimumLineSpacing: CGFloat = 0, options: NSLayoutFormatOptions = []) {
// if 0 < children.count {
// var format: String = "V:|-(left)-"
// var i: Int = 1
// var views: Dictionary<String, UIView> = Dictionary<String, UIView>()
// for v in children {
// views["view\(i++)"] = v
// format += i == children.count ? "[view\(i++)]-(right)-|" : "[view\(i++)]-(>=minimumLineSpacing)-"
// }
// parent.addConstraints(constraint(format, options: options, metrics: ["top" : top, "bottom": bottom, "minimumLineSpacing": minimumLineSpacing], views: views))
// }
// }
/** /**
:name: alignToParentHorizontally :name: alignToParentHorizontally
*/ */
public static func alignToParentHorizontally(parent: UIView, child: UIView, left: CGFloat = 0, right: CGFloat = 0) { public static func alignToParentHorizontally(parent: UIView, child: UIView, left: CGFloat = 0, right: CGFloat = 0, options: NSLayoutFormatOptions = []) {
parent.addConstraints(constraint("H:|-(left)-[child]-(right)-|", options: [], metrics: ["left": left, "right": right], views: ["child" : child])) parent.addConstraints(constraint("H:|-(left)-[child]-(right)-|", options: options, metrics: ["left": left, "right": right], views: ["child" : child]))
} }
/** /**
:name: alignToParentVertically :name: alignToParentVertically
*/ */
public static func alignToParentVertically(parent: UIView, child: UIView, top: CGFloat = 0, bottom: CGFloat = 0) { public static func alignToParentVertically(parent: UIView, child: UIView, top: CGFloat = 0, bottom: CGFloat = 0, options: NSLayoutFormatOptions = []) {
parent.addConstraints(constraint("V:|-(top)-[child]-(bottom)-|", options: [], metrics: ["bottom": bottom, "top": top], views: ["child" : child])) parent.addConstraints(constraint("V:|-(top)-[child]-(bottom)-|", options: options, metrics: ["bottom": bottom, "top": top], views: ["child" : child]))
} }
/** /**
:name: alignToParent :name: alignToParent
*/ */
public static func alignToParent(parent: UIView, child: UIView, top: CGFloat = 0, left: CGFloat = 0, bottom: CGFloat = 0, right: CGFloat = 0) { public static func alignToParent(parent: UIView, child: UIView, top: CGFloat = 0, left: CGFloat = 0, bottom: CGFloat = 0, right: CGFloat = 0, options: NSLayoutFormatOptions = []) {
alignToParentHorizontally(parent, child: child, left: left, right: right) alignToParentHorizontally(parent, child: child, left: left, right: right)
alignToParentVertically(parent, child: child, top: top, bottom: bottom) alignToParentVertically(parent, child: child, top: top, bottom: bottom)
} }
...@@ -70,7 +104,7 @@ public struct MaterialLayout { ...@@ -70,7 +104,7 @@ public struct MaterialLayout {
/** /**
:name: alignFromTopLeft :name: alignFromTopLeft
*/ */
public static func alignFromTopLeft(parent: UIView, child: UIView, top: CGFloat = 0, left: CGFloat = 0) { public static func alignFromTopLeft(parent: UIView, child: UIView, top: CGFloat = 0, left: CGFloat = 0, options: NSLayoutFormatOptions = []) {
alignFromTop(parent, child: child, top: top) alignFromTop(parent, child: child, top: top)
alignFromLeft(parent, child: child, left: left) alignFromLeft(parent, child: child, left: left)
} }
...@@ -78,7 +112,7 @@ public struct MaterialLayout { ...@@ -78,7 +112,7 @@ public struct MaterialLayout {
/** /**
:name: alignFromTopRight :name: alignFromTopRight
*/ */
public static func alignFromTopRight(parent: UIView, child: UIView, top: CGFloat = 0, right: CGFloat = 0) { public static func alignFromTopRight(parent: UIView, child: UIView, top: CGFloat = 0, right: CGFloat = 0, options: NSLayoutFormatOptions = []) {
alignFromTop(parent, child: child, top: top) alignFromTop(parent, child: child, top: top)
alignFromRight(parent, child: child, right: right) alignFromRight(parent, child: child, right: right)
} }
...@@ -86,7 +120,7 @@ public struct MaterialLayout { ...@@ -86,7 +120,7 @@ public struct MaterialLayout {
/** /**
:name: alignFromBottomLeft :name: alignFromBottomLeft
*/ */
public static func alignFromBottomLeft(parent: UIView, child: UIView, bottom: CGFloat = 0, left: CGFloat = 0) { public static func alignFromBottomLeft(parent: UIView, child: UIView, bottom: CGFloat = 0, left: CGFloat = 0, options: NSLayoutFormatOptions = []) {
alignFromBottom(parent, child: child, bottom: bottom) alignFromBottom(parent, child: child, bottom: bottom)
alignFromLeft(parent, child: child, left: left) alignFromLeft(parent, child: child, left: left)
} }
...@@ -94,7 +128,7 @@ public struct MaterialLayout { ...@@ -94,7 +128,7 @@ public struct MaterialLayout {
/** /**
:name: alignFromBottomRight :name: alignFromBottomRight
*/ */
public static func alignFromBottomRight(parent: UIView, child: UIView, bottom: CGFloat = 0, right: CGFloat = 0) { public static func alignFromBottomRight(parent: UIView, child: UIView, bottom: CGFloat = 0, right: CGFloat = 0, options: NSLayoutFormatOptions = []) {
alignFromBottom(parent, child: child, bottom: bottom) alignFromBottom(parent, child: child, bottom: bottom)
alignFromRight(parent, child: child, right: right) alignFromRight(parent, child: child, right: right)
} }
...@@ -102,29 +136,29 @@ public struct MaterialLayout { ...@@ -102,29 +136,29 @@ public struct MaterialLayout {
/** /**
:name: alignFromTop :name: alignFromTop
*/ */
public static func alignFromTop(parent: UIView, child: UIView, top: CGFloat = 0) { public static func alignFromTop(parent: UIView, child: UIView, top: CGFloat = 0, options: NSLayoutFormatOptions = []) {
parent.addConstraints(constraint("V:|-(top)-[child]", options: [], metrics: ["top" : top], views: ["child" : child])) parent.addConstraints(constraint("V:|-(top)-[child]", options: options, metrics: ["top" : top], views: ["child" : child]))
} }
/** /**
:name: alignFromLeft :name: alignFromLeft
*/ */
public static func alignFromLeft(parent: UIView, child: UIView, left: CGFloat = 0) { public static func alignFromLeft(parent: UIView, child: UIView, left: CGFloat = 0, options: NSLayoutFormatOptions = []) {
parent.addConstraints(constraint("H:|-(left)-[child]", options: [], metrics: ["left" : left], views: ["child" : child])) parent.addConstraints(constraint("H:|-(left)-[child]", options: options, metrics: ["left" : left], views: ["child" : child]))
} }
/** /**
:name: alignFromBottom :name: alignFromBottom
*/ */
public static func alignFromBottom(parent: UIView, child: UIView, bottom: CGFloat = 0) { public static func alignFromBottom(parent: UIView, child: UIView, bottom: CGFloat = 0, options: NSLayoutFormatOptions = []) {
parent.addConstraints(constraint("V:[child]-(bottom)-|", options: [], metrics: ["bottom" : bottom], views: ["child" : child])) parent.addConstraints(constraint("V:[child]-(bottom)-|", options: options, metrics: ["bottom" : bottom], views: ["child" : child]))
} }
/** /**
:name: alignFromRight :name: alignFromRight
*/ */
public static func alignFromRight(parent: UIView, child: UIView, right: CGFloat = 0) { public static func alignFromRight(parent: UIView, child: UIView, right: CGFloat = 0, options: NSLayoutFormatOptions = []) {
parent.addConstraints(constraint("H:[child]-(right)-|", options: [], metrics: ["right" : right], views: ["child" : child])) parent.addConstraints(constraint("H:[child]-(right)-|", options: options, metrics: ["right" : right], views: ["child" : child]))
} }
/** /**
......
...@@ -94,13 +94,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -94,13 +94,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
// //
private var sideTapGesture: UITapGestureRecognizer? private var sideTapGesture: UITapGestureRecognizer?
//
// :name: isViewBasedAppearance
//
private var isViewBasedAppearance: Bool {
return 0 == NSBundle.mainBundle().objectForInfoDictionaryKey("UIViewControllerBasedStatusBarAppearance") as? Int
}
/** /**
:name: delegate :name: delegate
*/ */
...@@ -448,15 +441,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -448,15 +441,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
// //
private func toggleStatusBar(hide: Bool = false) { private func toggleStatusBar(hide: Bool = false) {
if hideStatusBar { if hideStatusBar {
if isViewBasedAppearance { UIApplication.sharedApplication().statusBarHidden = hide
UIApplication.sharedApplication().setStatusBarHidden(hide, withAnimation: .Slide)
} else {
dispatch_async(dispatch_get_main_queue(), {
if let w = UIApplication.sharedApplication().keyWindow {
w.windowLevel = hide ? UIWindowLevelStatusBar + 1 : 0
}
})
}
} }
} }
......
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