Commit 87dd84ed by Daniel Dahan

adding StackView with examples

parent 7d7f9c8f
...@@ -63,6 +63,13 @@ ...@@ -63,6 +63,13 @@
location = "group:Programmatic/ImageCardView/ImageCardView.xcodeproj"> location = "group:Programmatic/ImageCardView/ImageCardView.xcodeproj">
</FileRef> </FileRef>
</Group> </Group>
<Group
location = "container:"
name = "StackView">
<FileRef
location = "group:Programmatic/StackView/StackView.xcodeproj">
</FileRef>
</Group>
</Group> </Group>
<Group <Group
location = "container:" location = "container:"
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:StackView.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.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-1.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 StackView.
// Uncomment different examples and read
// the comments below.
prepareGeneralStackViewExample()
}
/**
:name: prepareView
:description: General preparation statements.
*/
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/**
:name: prepareGeneralImageCardViewExample
:description: General usage example.
*/
private func prepareGeneralStackViewExample() {
}
}
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9608ABCD1C190B8B0000BB93 /* StackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9608ABCC1C190B8B0000BB93 /* StackView.swift */; };
963832421B88DFD80015F710 /* MaterialKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963832361B88DFD80015F710 /* MaterialKit.framework */; }; 963832421B88DFD80015F710 /* MaterialKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963832361B88DFD80015F710 /* MaterialKit.framework */; };
9638325A1B88E31A0015F710 /* MaterialKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963832581B88E31A0015F710 /* MaterialKitTests.swift */; }; 9638325A1B88E31A0015F710 /* MaterialKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963832581B88E31A0015F710 /* MaterialKitTests.swift */; };
96D88C1E1C1328D800B91418 /* CaptureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF51C1328D800B91418 /* CaptureView.swift */; }; 96D88C1E1C1328D800B91418 /* CaptureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF51C1328D800B91418 /* CaptureView.swift */; };
...@@ -92,6 +93,7 @@ ...@@ -92,6 +93,7 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9608ABCC1C190B8B0000BB93 /* StackView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StackView.swift; sourceTree = "<group>"; };
963832361B88DFD80015F710 /* MaterialKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MaterialKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 963832361B88DFD80015F710 /* MaterialKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MaterialKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
963832411B88DFD80015F710 /* MaterialKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MaterialKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 963832411B88DFD80015F710 /* MaterialKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MaterialKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
963832581B88E31A0015F710 /* MaterialKitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialKitTests.swift; sourceTree = "<group>"; }; 963832581B88E31A0015F710 /* MaterialKitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialKitTests.swift; sourceTree = "<group>"; };
...@@ -157,6 +159,14 @@ ...@@ -157,6 +159,14 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
9608ABCB1C190B7C0000BB93 /* Stack */ = {
isa = PBXGroup;
children = (
9608ABCC1C190B8B0000BB93 /* StackView.swift */,
);
name = Stack;
sourceTree = "<group>";
};
9638322C1B88DFD80015F710 = { 9638322C1B88DFD80015F710 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -204,6 +214,7 @@ ...@@ -204,6 +214,7 @@
96D88C4A1C13294200B91418 /* Type */, 96D88C4A1C13294200B91418 /* Type */,
96D88C491C13292700B91418 /* Capture */, 96D88C491C13292700B91418 /* Capture */,
96D88C471C1328F500B91418 /* Font */, 96D88C471C1328F500B91418 /* Font */,
9608ABCB1C190B7C0000BB93 /* Stack */,
); );
path = Sources; path = Sources;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -520,6 +531,7 @@ ...@@ -520,6 +531,7 @@
96D88C331C1328D800B91418 /* MaterialLabel.swift in Sources */, 96D88C331C1328D800B91418 /* MaterialLabel.swift in Sources */,
96D88C281C1328D800B91418 /* MaterialAnimation.swift in Sources */, 96D88C281C1328D800B91418 /* MaterialAnimation.swift in Sources */,
96D88C451C1328D800B91418 /* RobotoFont.swift in Sources */, 96D88C451C1328D800B91418 /* RobotoFont.swift in Sources */,
9608ABCD1C190B8B0000BB93 /* StackView.swift in Sources */,
96D88C1F1C1328D800B91418 /* CardView.swift in Sources */, 96D88C1F1C1328D800B91418 /* CardView.swift in Sources */,
96D88C2C1C1328D800B91418 /* MaterialColor.swift in Sources */, 96D88C2C1C1328D800B91418 /* MaterialColor.swift in Sources */,
96D88C301C1328D800B91418 /* MaterialEdgeInsets.swift in Sources */, 96D88C301C1328D800B91418 /* MaterialEdgeInsets.swift in Sources */,
......
...@@ -121,16 +121,6 @@ public class CapturePreviewView : MaterialView, UIGestureRecognizerDelegate { ...@@ -121,16 +121,6 @@ public class CapturePreviewView : MaterialView, UIGestureRecognizerDelegate {
} }
/** /**
:name: prepareView
*/
public override func prepareView() {
super.prepareView()
preparePreviewLayer()
tapToFocusEnabled = true
tapToExposeEnabled = true
}
/**
:name: captureDevicePointOfInterestForPoint :name: captureDevicePointOfInterestForPoint
*/ */
public func captureDevicePointOfInterestForPoint(point: CGPoint) -> CGPoint { public func captureDevicePointOfInterestForPoint(point: CGPoint) -> CGPoint {
...@@ -145,6 +135,16 @@ public class CapturePreviewView : MaterialView, UIGestureRecognizerDelegate { ...@@ -145,6 +135,16 @@ public class CapturePreviewView : MaterialView, UIGestureRecognizerDelegate {
} }
// //
// :name: prepareView
//
internal override func prepareView() {
super.prepareView()
preparePreviewLayer()
tapToFocusEnabled = true
tapToExposeEnabled = true
}
//
// :name: handleTapToFocusGesture // :name: handleTapToFocusGesture
// //
internal func handleTapToFocusGesture(recognizer: UITapGestureRecognizer) { internal func handleTapToFocusGesture(recognizer: UITapGestureRecognizer) {
......
...@@ -91,17 +91,6 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV ...@@ -91,17 +91,6 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV
} }
/** /**
:name: prepareView
*/
public override func prepareView() {
super.prepareView()
preparePreviewView()
prepareFocusLayer()
prepareExposureLayer()
reloadView()
}
/**
:name: reloadView :name: reloadView
*/ */
public func reloadView() { public func reloadView() {
...@@ -175,6 +164,17 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV ...@@ -175,6 +164,17 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV
} }
// //
// :name: prepareView
//
internal override func prepareView() {
super.prepareView()
preparePreviewView()
prepareFocusLayer()
prepareExposureLayer()
reloadView()
}
//
// :name: handleSwitchCameras // :name: handleSwitchCameras
// //
internal func handleSwitchCameras() { internal func handleSwitchCameras() {
......
...@@ -251,27 +251,6 @@ public class CardView : MaterialPulseView { ...@@ -251,27 +251,6 @@ public class CardView : MaterialPulseView {
} }
/** /**
:name: prepareView
*/
public override func prepareView() {
super.prepareView()
userInteractionEnabled = MaterialTheme.basicCardView.userInteractionEnabled
backgroundColor = MaterialTheme.basicCardView.backgroundColor
pulseColor = MaterialTheme.basicCardView.pulseColor
contentsRect = MaterialTheme.basicCardView.contentsRect
contentsCenter = MaterialTheme.basicCardView.contentsCenter
contentsScale = MaterialTheme.basicCardView.contentsScale
contentsGravity = MaterialTheme.basicCardView.contentsGravity
shadowDepth = MaterialTheme.basicCardView.shadowDepth
shadowColor = MaterialTheme.basicCardView.shadowColor
zPosition = MaterialTheme.basicCardView.zPosition
borderWidth = MaterialTheme.basicCardView.borderWidth
borderColor = MaterialTheme.basicCardView.bordercolor
dividerColor = MaterialTheme.basicCardView.dividerColor
}
/**
:name: reloadView :name: reloadView
*/ */
public func reloadView() { public func reloadView() {
...@@ -411,6 +390,27 @@ public class CardView : MaterialPulseView { ...@@ -411,6 +390,27 @@ public class CardView : MaterialPulseView {
} }
// //
// :name: prepareView
//
internal override func prepareView() {
super.prepareView()
userInteractionEnabled = MaterialTheme.basicCardView.userInteractionEnabled
backgroundColor = MaterialTheme.basicCardView.backgroundColor
pulseColor = MaterialTheme.basicCardView.pulseColor
contentsRect = MaterialTheme.basicCardView.contentsRect
contentsCenter = MaterialTheme.basicCardView.contentsCenter
contentsScale = MaterialTheme.basicCardView.contentsScale
contentsGravity = MaterialTheme.basicCardView.contentsGravity
shadowDepth = MaterialTheme.basicCardView.shadowDepth
shadowColor = MaterialTheme.basicCardView.shadowColor
zPosition = MaterialTheme.basicCardView.zPosition
borderWidth = MaterialTheme.basicCardView.borderWidth
borderColor = MaterialTheme.basicCardView.bordercolor
dividerColor = MaterialTheme.basicCardView.dividerColor
}
//
// :name: prepareDivider // :name: prepareDivider
// //
internal func prepareDivider(y: CGFloat, width: CGFloat) { internal func prepareDivider(y: CGFloat, width: CGFloat) {
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
import UIKit import UIKit
public class FabButton : MaterialButton { public class FabButton : MaterialButton {
/** //
:name: prepareView // :name: prepareView
*/ //
public override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
setTitleColor(MaterialTheme.fabButton.titleLabelColorForNormalState, forState: .Normal) setTitleColor(MaterialTheme.fabButton.titleLabelColorForNormalState, forState: .Normal)
titleLabel?.font = MaterialTheme.fabButton.titleLabelFont titleLabel?.font = MaterialTheme.fabButton.titleLabelFont
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
import UIKit import UIKit
public class FlatButton : MaterialButton { public class FlatButton : MaterialButton {
/** //
:name: prepareView // :name: prepareView
*/ //
public override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
setTitleColor(MaterialTheme.flatButton.titleLabelColorForNormalState, forState: .Normal) setTitleColor(MaterialTheme.flatButton.titleLabelColorForNormalState, forState: .Normal)
titleLabel?.font = MaterialTheme.flatButton.titleLabelFont titleLabel?.font = MaterialTheme.flatButton.titleLabelFont
......
...@@ -345,27 +345,6 @@ public class ImageCardView : MaterialPulseView { ...@@ -345,27 +345,6 @@ public class ImageCardView : MaterialPulseView {
} }
/** /**
:name: prepareView
*/
public override func prepareView() {
super.prepareView()
userInteractionEnabled = MaterialTheme.imageCardView.userInteractionEnabled
backgroundColor = MaterialTheme.imageCardView.backgroundColor
pulseColor = MaterialTheme.imageCardView.pulseColor
contentsRect = MaterialTheme.imageCardView.contentsRect
contentsCenter = MaterialTheme.imageCardView.contentsCenter
contentsScale = MaterialTheme.imageCardView.contentsScale
contentsGravity = MaterialTheme.imageCardView.contentsGravity
shadowDepth = MaterialTheme.imageCardView.shadowDepth
shadowColor = MaterialTheme.imageCardView.shadowColor
zPosition = MaterialTheme.imageCardView.zPosition
borderWidth = MaterialTheme.imageCardView.borderWidth
borderColor = MaterialTheme.imageCardView.bordercolor
dividerColor = MaterialTheme.imageCardView.dividerColor
}
/**
:name: reloadView :name: reloadView
*/ */
public func reloadView() { public func reloadView() {
...@@ -548,6 +527,27 @@ public class ImageCardView : MaterialPulseView { ...@@ -548,6 +527,27 @@ public class ImageCardView : MaterialPulseView {
} }
// //
// :name: prepareView
//
internal override func prepareView() {
super.prepareView()
userInteractionEnabled = MaterialTheme.imageCardView.userInteractionEnabled
backgroundColor = MaterialTheme.imageCardView.backgroundColor
pulseColor = MaterialTheme.imageCardView.pulseColor
contentsRect = MaterialTheme.imageCardView.contentsRect
contentsCenter = MaterialTheme.imageCardView.contentsCenter
contentsScale = MaterialTheme.imageCardView.contentsScale
contentsGravity = MaterialTheme.imageCardView.contentsGravity
shadowDepth = MaterialTheme.imageCardView.shadowDepth
shadowColor = MaterialTheme.imageCardView.shadowColor
zPosition = MaterialTheme.imageCardView.zPosition
borderWidth = MaterialTheme.imageCardView.borderWidth
borderColor = MaterialTheme.imageCardView.bordercolor
dividerColor = MaterialTheme.imageCardView.dividerColor
}
//
// :name: prepareImageLayer // :name: prepareImageLayer
// //
internal func prepareImageLayer() { internal func prepareImageLayer() {
......
...@@ -446,10 +446,10 @@ public class MaterialButton : UIButton { ...@@ -446,10 +446,10 @@ public class MaterialButton : UIButton {
return nil // returning nil enables the animations for the layer property that are normally disabled. return nil // returning nil enables the animations for the layer property that are normally disabled.
} }
/** //
:name: prepareView // :name: prepareView
*/ //
public func prepareView() { internal func prepareView() {
prepareVisualLayer() prepareVisualLayer()
preparePulseLayer() preparePulseLayer()
} }
......
...@@ -126,10 +126,10 @@ public class MaterialLabel : UILabel { ...@@ -126,10 +126,10 @@ public class MaterialLabel : UILabel {
return textLayer.stringSize(constrainedToWidth: width) return textLayer.stringSize(constrainedToWidth: width)
} }
/** //
:name: prepareView // :name: prepareView
*/ //
public func prepareView() { internal func prepareView() {
textAlignment = MaterialTheme.label.textAlignment textAlignment = MaterialTheme.label.textAlignment
wrapped = MaterialTheme.label.wrapped wrapped = MaterialTheme.label.wrapped
contentsScale = MaterialTheme.label.contentsScale contentsScale = MaterialTheme.label.contentsScale
......
...@@ -130,10 +130,10 @@ public class MaterialPulseView : MaterialView { ...@@ -130,10 +130,10 @@ public class MaterialPulseView : MaterialView {
shrink() shrink()
} }
/** //
:name: prepareView // :name: prepareView
*/ //
public override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
userInteractionEnabled = MaterialTheme.pulseView.userInteractionEnabled userInteractionEnabled = MaterialTheme.pulseView.userInteractionEnabled
backgroundColor = MaterialTheme.pulseView.backgroundColor backgroundColor = MaterialTheme.pulseView.backgroundColor
......
...@@ -382,7 +382,7 @@ public class MaterialView : UIView { ...@@ -382,7 +382,7 @@ public class MaterialView : UIView {
// //
// :name: prepareView // :name: prepareView
// //
public func prepareView() { internal func prepareView() {
userInteractionEnabled = MaterialTheme.view.userInteractionEnabled userInteractionEnabled = MaterialTheme.view.userInteractionEnabled
backgroundColor = MaterialTheme.view.backgroundColor backgroundColor = MaterialTheme.view.backgroundColor
......
...@@ -196,25 +196,6 @@ public class NavigationBarView : MaterialView { ...@@ -196,25 +196,6 @@ public class NavigationBarView : MaterialView {
} }
/** /**
:name: prepareView
*/
public override func prepareView() {
super.prepareView()
userInteractionEnabled = MaterialTheme.navigationBarView.userInteractionEnabled
backgroundColor = MaterialTheme.navigationBarView.backgroundColor
contentsRect = MaterialTheme.navigationBarView.contentsRect
contentsCenter = MaterialTheme.navigationBarView.contentsCenter
contentsScale = MaterialTheme.navigationBarView.contentsScale
contentsGravity = MaterialTheme.navigationBarView.contentsGravity
shadowDepth = MaterialTheme.navigationBarView.shadowDepth
shadowColor = MaterialTheme.navigationBarView.shadowColor
zPosition = MaterialTheme.navigationBarView.zPosition
borderWidth = MaterialTheme.navigationBarView.borderWidth
borderColor = MaterialTheme.navigationBarView.bordercolor
}
/**
:name: reloadView :name: reloadView
*/ */
public func reloadView() { public func reloadView() {
...@@ -335,6 +316,25 @@ public class NavigationBarView : MaterialView { ...@@ -335,6 +316,25 @@ public class NavigationBarView : MaterialView {
} }
// //
// :name: prepareView
//
internal override func prepareView() {
super.prepareView()
userInteractionEnabled = MaterialTheme.navigationBarView.userInteractionEnabled
backgroundColor = MaterialTheme.navigationBarView.backgroundColor
contentsRect = MaterialTheme.navigationBarView.contentsRect
contentsCenter = MaterialTheme.navigationBarView.contentsCenter
contentsScale = MaterialTheme.navigationBarView.contentsScale
contentsGravity = MaterialTheme.navigationBarView.contentsGravity
shadowDepth = MaterialTheme.navigationBarView.shadowDepth
shadowColor = MaterialTheme.navigationBarView.shadowColor
zPosition = MaterialTheme.navigationBarView.zPosition
borderWidth = MaterialTheme.navigationBarView.borderWidth
borderColor = MaterialTheme.navigationBarView.bordercolor
}
//
// :name: prepareProperties // :name: prepareProperties
// //
internal func prepareProperties(titleLabel: UILabel?, detailLabel: UILabel?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) { internal func prepareProperties(titleLabel: UILabel?, detailLabel: UILabel?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) {
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
import UIKit import UIKit
public class RaisedButton : MaterialButton { public class RaisedButton : MaterialButton {
/** //
:name: prepareView // :name: prepareView
*/ //
public override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
setTitleColor(MaterialTheme.raisedButton.titleLabelColorForNormalState, forState: .Normal) setTitleColor(MaterialTheme.raisedButton.titleLabelColorForNormalState, forState: .Normal)
titleLabel!.font = MaterialTheme.raisedButton.titleLabelFont titleLabel!.font = MaterialTheme.raisedButton.titleLabelFont
......
//
// 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
@available(iOS 9.0, *)
public class StackView : UIStackView {
/**
:name: init
*/
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
prepareView()
}
/**
:name: init
*/
public override init(frame: CGRect) {
super.init(frame: frame)
prepareView()
}
/**
:name: init
*/
public convenience init() {
self.init(frame: CGRectNull)
}
//
// :name: prepareView
//
private func 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