Commit 85dae35e by Daniel Dahan

removed storyboard NavigationDrawerController example

parent 8b1fc4de
...@@ -125,8 +125,5 @@ ...@@ -125,8 +125,5 @@
<FileRef <FileRef
location = "group:Storyboards/BottomTabBar/BottomTabBar.xcodeproj"> location = "group:Storyboards/BottomTabBar/BottomTabBar.xcodeproj">
</FileRef> </FileRef>
<FileRef
location = "group:Storyboards/NavigationDrawerController/NavigationDrawerController.xcodeproj">
</FileRef>
</Group> </Group>
</Workspace> </Workspace>
...@@ -38,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -38,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let navigationController: NavigationController = NavigationController(rootViewController: YellowViewController()) let navigationController: NavigationController = NavigationController(rootViewController: YellowViewController())
let navigationDrawerController: NavigationDrawerController = NavigationDrawerController(rootViewController: navigationController, leftViewController: AppLeftViewController(), rightViewController: BlueViewController()) let navigationDrawerController: NavigationDrawerController = NavigationDrawerController(rootViewController: navigationController, leftViewController: AppLeftViewController())
// navigationDrawerController.enabled = true // navigationDrawerController.enabled = true
// //
......
...@@ -41,7 +41,7 @@ class AppLeftViewController: UIViewController { ...@@ -41,7 +41,7 @@ class AppLeftViewController: UIViewController {
private var tableView: UITableView! private var tableView: UITableView!
/// A list of all the navigation items. /// A list of all the navigation items.
private var items: Array<Item>! private var dataSourceItems: Array<Item>!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -57,12 +57,11 @@ class AppLeftViewController: UIViewController { ...@@ -57,12 +57,11 @@ class AppLeftViewController: UIViewController {
/// Prepares the items that are displayed within the tableView. /// Prepares the items that are displayed within the tableView.
private func prepareCells() { private func prepareCells() {
items = Array<Item>() dataSourceItems = Array<Item>()
items.append(Item(text: "Orange", image: MaterialIcon.cm.audioLibrary)) dataSourceItems.append(Item(text: "Orange", image: MaterialIcon.cm.audioLibrary))
items.append(Item(text: "Purple", image: MaterialIcon.cm.photoLibrary)) dataSourceItems.append(Item(text: "Purple", image: MaterialIcon.cm.photoLibrary))
items.append(Item(text: "Green", image: MaterialIcon.cm.microphone)) dataSourceItems.append(Item(text: "Green", image: MaterialIcon.cm.microphone))
items.append(Item(text: "Blue", image: MaterialIcon.cm.audio)) dataSourceItems.append(Item(text: "Blue", image: MaterialIcon.cm.audio))
items.append(Item(text: "Yellow", image: MaterialIcon.cm.settings))
} }
/// Prepares the tableView. /// Prepares the tableView.
...@@ -75,7 +74,7 @@ class AppLeftViewController: UIViewController { ...@@ -75,7 +74,7 @@ class AppLeftViewController: UIViewController {
tableView.separatorStyle = .None tableView.separatorStyle = .None
// Use Layout to easily align the tableView. // Use Layout to easily align the tableView.
view.layout(tableView).edges(top: 170) view.layout(tableView).edges(top: 64)
} }
} }
...@@ -83,14 +82,14 @@ class AppLeftViewController: UIViewController { ...@@ -83,14 +82,14 @@ class AppLeftViewController: UIViewController {
extension AppLeftViewController: UITableViewDataSource { extension AppLeftViewController: UITableViewDataSource {
/// Determines the number of rows in the tableView. /// Determines the number of rows in the tableView.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count; return dataSourceItems.count;
} }
/// Prepares the cells within the tableView. /// Prepares the cells within the tableView.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: MaterialTableViewCell = tableView.dequeueReusableCellWithIdentifier("MaterialTableViewCell", forIndexPath: indexPath) as! MaterialTableViewCell let cell: MaterialTableViewCell = tableView.dequeueReusableCellWithIdentifier("MaterialTableViewCell", forIndexPath: indexPath) as! MaterialTableViewCell
let item: Item = items[indexPath.row] let item: Item = dataSourceItems[indexPath.row]
cell.textLabel!.text = item.text cell.textLabel!.text = item.text
cell.textLabel!.textColor = MaterialColor.grey.lighten2 cell.textLabel!.textColor = MaterialColor.grey.lighten2
...@@ -112,27 +111,20 @@ extension AppLeftViewController: UITableViewDelegate { ...@@ -112,27 +111,20 @@ extension AppLeftViewController: UITableViewDelegate {
/// Select item at row in tableView. /// Select item at row in tableView.
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let item: Item = items[indexPath.row] let item: Item = dataSourceItems[indexPath.row]
switch item.text { if let v: NavigationController = navigationDrawerController?.rootViewController as? NavigationController {
case "Orange": switch item.text {
navigationDrawerController?.transitionFromRootViewController(OrangeViewController()) case "Orange":
case "Purple": v.pushViewController(OrangeViewController(), animated: true)
navigationDrawerController?.transitionFromRootViewController(PurpleViewController()) case "Purple":
case "Green": v.pushViewController(PurpleViewController(), animated: true)
navigationDrawerController?.transitionFromRootViewController(GreenViewController()) case "Green":
case "Blue": v.pushViewController(GreenViewController(), animated: true)
navigationDrawerController?.transitionFromRootViewController(BlueViewController()) case "Blue":
case "Yellow": v.pushViewController(BlueViewController(), animated: true)
// To close the navigationDrawerController after loading the UIViewController, use the following. default:break
navigationDrawerController?.transitionFromRootViewController(YellowViewController(), }
duration: 1,
options: .TransitionNone,
animations: nil,
completion: { [weak self] _ in
self?.navigationDrawerController?.closeLeftView()
})
default:break
} }
} }
} }
...@@ -35,10 +35,24 @@ class BlueViewController: UIViewController { ...@@ -35,10 +35,24 @@ class BlueViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareNavigationItem()
} }
/// Prepares view. override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
navigationDrawerController?.closeLeftView()
navigationDrawerController?.enabled = false
}
/// Prepares the view.
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.blue.base view.backgroundColor = MaterialColor.blue.base
} }
/// Prepares the navigationItem.
private func prepareNavigationItem() {
navigationItem.title = "Blue"
navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.font = RobotoFont.mediumWithSize(20)
}
} }
...@@ -35,10 +35,24 @@ class GreenViewController: UIViewController { ...@@ -35,10 +35,24 @@ class GreenViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareNavigationItem()
} }
/// Prepares view. override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
navigationDrawerController?.closeLeftView()
navigationDrawerController?.enabled = false
}
/// Prepares the view.
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.green.base view.backgroundColor = MaterialColor.green.base
} }
/// Prepares the navigationItem.
private func prepareNavigationItem() {
navigationItem.title = "Green"
navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.font = RobotoFont.mediumWithSize(20)
}
} }
...@@ -35,10 +35,24 @@ class OrangeViewController: UIViewController { ...@@ -35,10 +35,24 @@ class OrangeViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareNavigationItem()
} }
/// Prepares view. override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
navigationDrawerController?.closeLeftView()
navigationDrawerController?.enabled = false
}
/// Prepares the view.
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.orange.base view.backgroundColor = MaterialColor.orange.base
} }
/// Prepares the navigationItem.
private func prepareNavigationItem() {
navigationItem.title = "Orange"
navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.font = RobotoFont.mediumWithSize(20)
}
} }
...@@ -35,10 +35,24 @@ class PurpleViewController: UIViewController { ...@@ -35,10 +35,24 @@ class PurpleViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareNavigationItem()
} }
/// Prepares view. override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
navigationDrawerController?.closeLeftView()
navigationDrawerController?.enabled = false
}
/// Prepares the view.
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.purple.base view.backgroundColor = MaterialColor.purple.base
} }
/// Prepares the navigationItem.
private func prepareNavigationItem() {
navigationItem.title = "Purple"
navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.font = RobotoFont.mediumWithSize(20)
}
} }
...@@ -51,9 +51,18 @@ class YellowViewController: UIViewController { ...@@ -51,9 +51,18 @@ class YellowViewController: UIViewController {
prepareNavigationBar() prepareNavigationBar()
} }
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
navigationDrawerController?.enabled = true
}
internal func handleMenuButton() {
navigationDrawerController?.openLeftView()
}
/// Prepares the view. /// Prepares the view.
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.grey.lighten5 view.backgroundColor = MaterialColor.yellow.base
} }
/// Prepares the menuButton. /// Prepares the menuButton.
...@@ -63,6 +72,7 @@ class YellowViewController: UIViewController { ...@@ -63,6 +72,7 @@ class YellowViewController: UIViewController {
menuButton.pulseColor = MaterialColor.white menuButton.pulseColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal) menuButton.setImage(image, forState: .Normal)
menuButton.setImage(image, forState: .Highlighted) menuButton.setImage(image, forState: .Highlighted)
menuButton.addTarget(self, action: #selector(handleMenuButton), forControlEvents: .TouchUpInside)
} }
/// Prepares the switchControl. /// Prepares the switchControl.
...@@ -81,7 +91,7 @@ class YellowViewController: UIViewController { ...@@ -81,7 +91,7 @@ class YellowViewController: UIViewController {
/// Prepares the navigationItem. /// Prepares the navigationItem.
private func prepareNavigationItem() { private func prepareNavigationItem() {
navigationItem.title = "Recipes" navigationItem.title = "Yellow"
navigationItem.titleLabel.textAlignment = .Left navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.font = RobotoFont.mediumWithSize(20) navigationItem.titleLabel.font = RobotoFont.mediumWithSize(20)
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:NavigationDrawerController.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
import Material
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Get view controllers from storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let rootViewController = storyboard.instantiateViewControllerWithIdentifier("RootViewController") as! RootViewController
let drawerViewController = storyboard.instantiateViewControllerWithIdentifier("DrawerViewController") as! DrawerViewController
// Configure the window with the NavigationDrawerController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = NavigationDrawerController(rootViewController: rootViewController, leftViewController: drawerViewController)
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" : "MaterialColorsAppIcon_Icon-29@2x-1.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "MaterialColorsAppIcon_Icon-29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "MaterialColorsAppIcon_Icon-40@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "MaterialColorsAppIcon_Icon-40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "MaterialColorsAppIcon_Icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "MaterialColorsAppIcon_Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "MaterialColorsAppIcon_Icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "MaterialColorsAppIcon_Icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "MaterialColorsAppIcon_Icon-40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "MaterialColorsAppIcon_Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "MaterialColorsAppIcon_Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "MaterialColorsAppIcon_Icon-76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "MaterialColorsAppIcon_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" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Root View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="RootViewController" customModule="NavigationDrawerController" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
<!--Drawer View Controller-->
<scene sceneID="hLH-kg-mtG">
<objects>
<viewController id="06L-FT-Qi1" customClass="DrawerViewController" customModule="NavigationDrawerController" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="6wn-C8-Wj8"/>
<viewControllerLayoutGuide type="bottom" id="2M5-ul-HvM"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="e7g-Fd-L6H">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="h7a-OV-6Fo" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1575" y="913"/>
</scene>
</scenes>
</document>
/*
* 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
class DrawerViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
}
<?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>UIMainStoryboardFile</key>
<string>Main</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.
*/
import UIKit
import Material
class RootViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Toggle NavigationDrawerController.
let img: UIImage? = MaterialIcon.cm.pen
let fabButton: FabButton = FabButton()
fabButton.setImage(img, forState: .Normal)
fabButton.setImage(img, forState: .Highlighted)
fabButton.addTarget(self, action: #selector(handleFabButton), forControlEvents: .TouchUpInside)
view.layout(fabButton).width(64).height(64).bottom(16).right(16)
}
// FabButton handler.
func handleFabButton() {
navigationDrawerController?.toggleLeftView()
}
}
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