Commit 5a88dac9 by GilthonweApps

Merge remote-tracking branch 'CosmicMind/master' into UIImageBlur

parents 0303208c 7e5df226
......@@ -11,6 +11,9 @@
location = "group:Programmatic/App/App.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/MaterialIcon/MaterialIcon.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/MaterialLayout/MaterialLayout.xcodeproj">
</FileRef>
<FileRef
......@@ -38,6 +41,9 @@
location = "group:Programmatic/MaterialSwitch/MaterialSwitch.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/MaterialCollectionView/MaterialCollectionView.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/Menu/Menu.xcodeproj">
</FileRef>
<FileRef
......@@ -47,7 +53,10 @@
location = "group:Programmatic/MenuViewController/MenuViewController.xcodeproj">
</FileRef>
<FileRef
location = "group:/Users/danieldahan/Dropbox/CosmicMind/Technology/Repositories/Material/Examples/Programmatic/NavigationBar/NavigationBar.xcodeproj">
location = "group:Programmatic/TabBar/TabBar.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/NavigationBar/NavigationBar.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/Toolbar/Toolbar.xcodeproj">
......@@ -62,12 +71,18 @@
location = "group:Programmatic/SearchBarController/SearchBarController.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/BottomNavigationBar/BottomNavigationBar.xcodeproj">
location = "group:Programmatic/BottomTabBar/BottomTabBar.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/BottomNavigationController/BottomNavigationController.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/SideNavigationController/SideNavigationController.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/ControlView/ControlView.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/CardView/CardView.xcodeproj">
</FileRef>
<FileRef
......@@ -102,6 +117,12 @@
location = "group:Storyboards/Toolbar/Toolbar.xcodeproj">
</FileRef>
<FileRef
location = "group:Storyboards/BottomTabBar/BottomTabBar.xcodeproj">
</FileRef>
<FileRef
location = "group:Storyboards/NavigationController/NavigationController.xcodeproj">
</FileRef>
<FileRef
location = "group:Storyboards/SideNavigationController/SideNavigationController.xcodeproj">
</FileRef>
</Group>
......
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
96162C6C1CA71C8700E3A235 /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6B1CA71C8700E3A235 /* VideoViewController.swift */; };
96162C6E1CA7274E00E3A235 /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */; };
9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9311C7A744600AF0965 /* AppDelegate.swift */; };
9663F9341C7A744600AF0965 /* RecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */; };
9663F9391C7A744600AF0965 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9663F9381C7A744600AF0965 /* Assets.xcassets */; };
......@@ -15,7 +17,6 @@
9663F94A1C7A74B500AF0965 /* AppSearchBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9491C7A74B500AF0965 /* AppSearchBarViewController.swift */; };
9663F94C1C7A74C700AF0965 /* AppMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94B1C7A74C700AF0965 /* AppMenuViewController.swift */; };
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; };
9663F9501C7A74FC00AF0965 /* AppRightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94F1C7A74FC00AF0965 /* AppRightViewController.swift */; };
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; };
96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; };
/* End PBXBuildFile section */
......@@ -34,6 +35,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
96162C6B1CA71C8700E3A235 /* VideoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoViewController.swift; sourceTree = "<group>"; };
96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoViewController.swift; sourceTree = "<group>"; };
9663F92E1C7A744600AF0965 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
9663F9311C7A744600AF0965 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9663F9331C7A744600AF0965 /* RecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendationViewController.swift; sourceTree = "<group>"; };
......@@ -44,7 +47,6 @@
9663F9491C7A74B500AF0965 /* AppSearchBarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppSearchBarViewController.swift; sourceTree = "<group>"; };
9663F94B1C7A74C700AF0965 /* AppMenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppMenuViewController.swift; sourceTree = "<group>"; };
9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; };
9663F94F1C7A74FC00AF0965 /* AppRightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppRightViewController.swift; sourceTree = "<group>"; };
9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; };
96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -84,10 +86,11 @@
9663F9491C7A74B500AF0965 /* AppSearchBarViewController.swift */,
9663F94B1C7A74C700AF0965 /* AppMenuViewController.swift */,
9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */,
9663F94F1C7A74FC00AF0965 /* AppRightViewController.swift */,
96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */,
9663F9331C7A744600AF0965 /* RecommendationViewController.swift */,
9663F9511C7A751D00AF0965 /* ItemViewController.swift */,
96162C6B1CA71C8700E3A235 /* VideoViewController.swift */,
96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */,
9663F9381C7A744600AF0965 /* Assets.xcassets */,
9663F93A1C7A744600AF0965 /* LaunchScreen.storyboard */,
9663F93D1C7A744600AF0965 /* Info.plist */,
......@@ -168,13 +171,14 @@
files = (
9663F94A1C7A74B500AF0965 /* AppSearchBarViewController.swift in Sources */,
96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */,
9663F9501C7A74FC00AF0965 /* AppRightViewController.swift in Sources */,
9663F9481C7A749400AF0965 /* AppNavigationController.swift in Sources */,
9663F9341C7A744600AF0965 /* RecommendationViewController.swift in Sources */,
9663F94C1C7A74C700AF0965 /* AppMenuViewController.swift in Sources */,
9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */,
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */,
96162C6C1CA71C8700E3A235 /* VideoViewController.swift in Sources */,
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */,
96162C6E1CA7274E00E3A235 /* PhotoViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -37,9 +37,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let navigationController: NavigationController = AppNavigationController(rootViewController: RecipesViewController())
let menuViewController: MenuViewController = AppMenuViewController(rootViewController: navigationController)
menuViewController.edgesForExtendedLayout = .None
let bottomNavigationController: BottomNavigationController = BottomNavigationController()
bottomNavigationController.viewControllers = [menuViewController, VideoViewController(), PhotoViewController()]
bottomNavigationController.selectedIndex = 0
bottomNavigationController.tabBar.tintColor = MaterialColor.white
bottomNavigationController.tabBar.backgroundColor = MaterialColor.grey.darken4
let sideNavigationController: SideNavigationController = SideNavigationController(rootViewController: bottomNavigationController, leftViewController: AppLeftViewController())
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = SideNavigationController(mainViewController: AppMenuViewController(mainViewController: AppNavigationController(rootViewController: RecipesViewController())), leftViewController: AppLeftViewController(), rightViewController: AppRightViewController())
window!.rootViewController = sideNavigationController
window!.makeKeyAndVisible()
return true
}
......
......@@ -156,6 +156,6 @@ extension AppLeftViewController: UITableViewDelegate {
/// Select item at row in tableView.
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("Cell selected")
// print("Selected")
}
}
......@@ -43,12 +43,30 @@ class AppMenuViewController: MenuViewController {
/// MenuView inset.
private let menuViewInset: CGFloat = 16
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareMenuView()
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
closeMenu()
}
override func openMenu(completion: (() -> Void)? = nil) {
super.openMenu(completion)
sideNavigationController?.enabled = false
......@@ -92,37 +110,40 @@ class AppMenuViewController: MenuViewController {
/// Prepares the add button.
private func prepareMenuView() {
var image: UIImage? = MaterialIcon.add
var image: UIImage? = MaterialIcon.cm.add
let menuButton: FabButton = FabButton()
menuButton.tintColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal)
menuButton.setImage(image, forState: .Highlighted)
menuButton.addTarget(self, action: "handleMenu", forControlEvents: .TouchUpInside)
menuButton.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(menuButton)
image = UIImage(named: "ic_create_white")
image = MaterialIcon.cm.pen
let blueButton: FabButton = FabButton()
blueButton.tintColor = MaterialColor.white
blueButton.backgroundColor = MaterialColor.blue.base
blueButton.setImage(image, forState: .Normal)
blueButton.setImage(image, forState: .Highlighted)
menuView.addSubview(blueButton)
blueButton.addTarget(self, action: "handleBlueButton", forControlEvents: .TouchUpInside)
blueButton.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
image = UIImage(named: "ic_photo_camera_white")
image = MaterialIcon.cm.photoCamera
let greenButton: FabButton = FabButton()
greenButton.tintColor = MaterialColor.white
greenButton.backgroundColor = MaterialColor.green.base
greenButton.setImage(image, forState: .Normal)
greenButton.setImage(image, forState: .Highlighted)
menuView.addSubview(greenButton)
greenButton.addTarget(self, action: "handleGreenButton", forControlEvents: .TouchUpInside)
greenButton.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
image = UIImage(named: "ic_note_add_white")
image = MaterialIcon.cm.star
let yellowButton: FabButton = FabButton()
yellowButton.tintColor = MaterialColor.white
yellowButton.backgroundColor = MaterialColor.yellow.base
yellowButton.setImage(image, forState: .Normal)
yellowButton.setImage(image, forState: .Highlighted)
menuView.addSubview(yellowButton)
yellowButton.addTarget(self, action: "handleYellowButton", forControlEvents: .TouchUpInside)
yellowButton.addTarget(self, action: #selector(handleYellowButton), forControlEvents: .TouchUpInside)
// Initialize the menu and setup the configuration options.
menuView.menu.baseViewSize = baseViewSize
......@@ -133,5 +154,12 @@ class AppMenuViewController: MenuViewController {
MaterialLayout.size(view, child: menuView, width: baseViewSize.width, height: baseViewSize.height)
MaterialLayout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset)
}
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = MaterialIcon.cm.photoLibrary
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.white, forState: .Selected)
}
}
......@@ -32,9 +32,35 @@ import UIKit
import Material
class AppNavigationController: NavigationController {
/// StatusBar color reference.
private var statusBarView: MaterialView?
override func viewDidLoad() {
super.viewDidLoad()
prepareStatusBarView()
prepareNavigationBar()
}
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
statusBarView?.hidden = MaterialDevice.statusBarHidden
}
/// Prepares the statusBarView
private func prepareStatusBarView() {
statusBarView = MaterialView()
statusBarView!.backgroundColor = MaterialColor.blue.darken2
view.addSubview(statusBarView!)
statusBarView!.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTop(view, child: statusBarView!)
MaterialLayout.alignToParentHorizontally(view, child: statusBarView!)
MaterialLayout.height(view, child: statusBarView!, height: 20)
}
/// Prepares the navigationBar
private func prepareNavigationBar() {
navigationBar.statusBarStyle = .LightContent
navigationBar.tintColor = MaterialColor.white
navigationBar.backgroundColor = MaterialColor.blue.base
......
......@@ -43,12 +43,6 @@ class AppSearchBarController: SearchBarController {
prepareSearchBar()
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
searchBar.textField.resignFirstResponder()
sideNavigationController?.enabled = true
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
searchBar.statusBarStyle = .Default
......@@ -60,6 +54,12 @@ class AppSearchBarController: SearchBarController {
searchBar.textField.becomeFirstResponder()
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
searchBar.textField.resignFirstResponder()
sideNavigationController?.enabled = true
}
/// Toggle SideSearchViewController left UIViewController.
internal func handleBackButton() {
searchBar.textField.resignFirstResponder()
......@@ -74,44 +74,27 @@ class AppSearchBarController: SearchBarController {
/// Prepares the searchBar.
private func prepareSearchBar() {
var image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton()
clearButton.pulseScale = false
clearButton.pulseColor = MaterialColor.grey.darken4
clearButton.tintColor = MaterialColor.grey.darken4
clearButton.setImage(image, forState: .Normal)
clearButton.setImage(image, forState: .Highlighted)
var image: UIImage? = MaterialIcon.cm.arrowBack
// Back button.
image = MaterialIcon.arrowBack
let backButton: FlatButton = FlatButton()
backButton.pulseScale = false
backButton.pulseColor = MaterialColor.grey.darken4
backButton.pulseColor = MaterialColor.grey.base
backButton.tintColor = MaterialColor.grey.darken4
backButton.setImage(image, forState: .Normal)
backButton.setImage(image, forState: .Highlighted)
backButton.addTarget(self, action: "handleBackButton", forControlEvents: .TouchUpInside)
backButton.addTarget(self, action: #selector(handleBackButton), forControlEvents: .TouchUpInside)
// More button.
image = MaterialIcon.moreHorizontal
image = MaterialIcon.cm.moreHorizontal
let moreButton: FlatButton = FlatButton()
moreButton.pulseScale = false
moreButton.pulseColor = MaterialColor.grey.darken4
moreButton.pulseColor = MaterialColor.grey.base
moreButton.tintColor = MaterialColor.grey.darken4
moreButton.setImage(image, forState: .Normal)
moreButton.setImage(image, forState: .Highlighted)
searchBar.placeholder = "Search"
searchBar.tintColor = MaterialColor.grey.darken4
searchBar.textColor = MaterialColor.grey.darken4
searchBar.placeholderTextColor = MaterialColor.grey.darken4
searchBar.textField.font = RobotoFont.regular
searchBar.textField.delegate = self
searchBar.contentInset.left = 8
searchBar.contentInset.right = 8
searchBar.clearButton = clearButton
searchBar.leftControls = [backButton]
searchBar.rightControls = [moreButton]
}
......@@ -119,10 +102,10 @@ class AppSearchBarController: SearchBarController {
extension AppSearchBarController: TextFieldDelegate {
func textFieldDidBeginEditing(textField: UITextField) {
print("Begin searching....")
// print("Begin searching....")
}
func textFieldDidEndEditing(textField: UITextField) {
print("End searching....")
// print("End searching....")
}
}
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
......@@ -15,7 +16,6 @@
<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>
......
......@@ -34,6 +34,8 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
......
......@@ -47,11 +47,8 @@ class ItemViewController: UIViewController {
/// NavigationBar share button.
private var shareButton: FlatButton!
/// MaterialCollectionView.
private var collectionView: MaterialCollectionView!
/// Image thumbnail height.
private var thumbnailHieght: CGFloat = 300
/// MaterialScrollView.
private var scrollView: UIScrollView!
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
......@@ -71,17 +68,37 @@ class ItemViewController: UIViewController {
prepareView()
prepareTitleLabel()
prepareShareButton()
prepareNavigationBar()
prepareNavigationItem()
prepareScrollView()
prepareImageCardView()
}
/// Handler for shareButton.
internal func handleShareButton() {
print("Share Button Pressed")
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
sideNavigationController?.enabled = false
// Stops the scrollView contentInsets from being automatically adjusted.
automaticallyAdjustsScrollViewInsets = false
}
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
scrollView.frame = view.bounds
scrollView.removeConstraints(scrollView.constraints)
MaterialLayout.width(scrollView, child: imageCardView, width: scrollView.bounds.width)
imageCardView.layoutIfNeeded()
scrollView.contentSize = CGSizeMake(view.bounds.width, imageCardView.height)
imageCardView.reloadView()
imageCardView.contentsGravityPreset = .ResizeAspectFill
imageCardView.titleLabelInset.top = imageCardView.imageLayer!.frame.height
}
private func prepareView() {
view.backgroundColor = MaterialColor.white
automaticallyAdjustsScrollViewInsets = false
}
/// Prepares the titleLabel.
......@@ -102,26 +119,30 @@ class ItemViewController: UIViewController {
/// Prepares the shareButton.
private func prepareShareButton() {
let image: UIImage? = MaterialIcon.share
let image: UIImage? = MaterialIcon.cm.share
shareButton = FlatButton()
shareButton.pulseScale = false
shareButton.pulseColor = MaterialColor.white
shareButton.setImage(image, forState: .Normal)
shareButton.setImage(image, forState: .Highlighted)
shareButton.addTarget(self, action: "handleShareButton", forControlEvents: .TouchUpInside)
}
/// Prepares view.
private func prepareNavigationBar() {
/// Prepares the navigationItem.
private func prepareNavigationItem() {
navigationItem.titleLabel = titleLabel
navigationItem.detailLabel = detailLabel
navigationItem.rightControls = [shareButton]
}
/// Prepares the scrollView.
private func prepareScrollView() {
scrollView = UIScrollView(frame: view.bounds)
view.addSubview(scrollView)
}
/// Prepares the imageCardView.
private func prepareImageCardView() {
if let data: Dictionary<String, AnyObject> = dataSource.data as? Dictionary<String, AnyObject> {
let height: CGFloat = 300
imageCardView = ImageCardView()
......@@ -131,12 +152,12 @@ class ItemViewController: UIViewController {
imageCardView.depth = .None
imageCardView.contentInsetPreset = .Square3
imageCardView.cornerRadiusPreset = .None
imageCardView.maxImageHeight = 300
imageCardView.titleLabel = UILabel()
imageCardView.titleLabel?.text = data["title"] as? String
imageCardView.titleLabel?.textColor = MaterialColor.grey.darken4
imageCardView.titleLabel?.font = RobotoFont.regularWithSize(20)
imageCardView.titleLabelInset.top = height
let detailLabel: UILabel = UILabel()
detailLabel.text = data["detail"] as? String
......@@ -147,15 +168,11 @@ class ItemViewController: UIViewController {
imageCardView.detailView = detailLabel
imageCardView.detailViewInset.top = 52
if let v: CGFloat = view.bounds.width {
let image: UIImage? = UIImage(named: data["image"] as! String)?.resize(toWidth: v)?.crop(toWidth: v, toHeight: height)
imageCardView.image = image
}
view.addSubview(imageCardView)
let image: UIImage? = UIImage(named: data["image"] as! String)
imageCardView.image = image
scrollView.addSubview(imageCardView)
imageCardView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTop(view, child: imageCardView)
MaterialLayout.alignToParentHorizontally(view, child: imageCardView)
}
}
}
......@@ -31,41 +31,34 @@
import UIKit
import Material
class ViewController: UIViewController {
/// Reference for NavigationBar.
private var bottomNavigationBar: BottomNavigationBar!
class PhotoViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareBottomNavigationBar()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.white
view.backgroundColor = MaterialColor.green.base
}
/// Prepare bottomNavigationBar.
private func prepareBottomNavigationBar() {
bottomNavigationBar = BottomNavigationBar()
bottomNavigationBar.backgroundColor = MaterialColor.grey.darken4
view.addSubview(bottomNavigationBar)
let item1: BottomNavigationBarItem = BottomNavigationBarItem(title: "Video", image: UIImage(named:"ic_videocam_white")?.imageWithRenderingMode(.AlwaysTemplate), selectedImage: UIImage(named:"ic_videocam_white"))
item1.setTitleColor(MaterialColor.grey.base, forState: .Normal)
item1.setTitleColor(MaterialColor.yellow.base, forState: .Selected)
let item2: BottomNavigationBarItem = BottomNavigationBarItem(title: "Photo", image: UIImage(named:"ic_photo_camera_white")?.imageWithRenderingMode(.AlwaysTemplate), selectedImage: UIImage(named:"ic_photo_camera_white"))
item2.setTitleColor(MaterialColor.grey.base, forState: .Normal)
item2.setTitleColor(MaterialColor.yellow.base, forState: .Selected)
let item3: BottomNavigationBarItem = BottomNavigationBarItem(title: "Library", image: UIImage(named:"ic_photo_library_white")?.imageWithRenderingMode(.AlwaysTemplate), selectedImage: UIImage(named:"ic_photo_library_white"))
item3.setTitleColor(MaterialColor.grey.base, forState: .Normal)
item3.setTitleColor(MaterialColor.yellow.base, forState: .Selected)
bottomNavigationBar.setItems([item1, item2, item3], animated: true)
bottomNavigationBar.tintColor = MaterialColor.yellow.base
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = MaterialIcon.cm.photoCamera
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.white, forState: .Selected)
}
}
......@@ -47,28 +47,35 @@ class RecipesViewController: UIViewController {
/// NavigationBar search button.
private var searchButton: FlatButton!
/// A tableView used to display Bond entries.
/// A tableView used to display items.
private var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareItems()
prepareTitleLabel()
prepareMenuButton()
prepareSwitchControl()
prepareSearchButton()
prepareNavigationBar()
prepareNavigationItem()
prepareTableView()
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
// Stops the tableView contentInsets from being automatically adjusted.
automaticallyAdjustsScrollViewInsets = false
// Set the navigationBar style.
navigationController?.navigationBar.statusBarStyle = .LightContent
// Enable the SideNavigation.
sideNavigationController?.enabled = true
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
// Show the menuView.
menuViewController?.menuView.animate(MaterialAnimation.animationGroup([
MaterialAnimation.rotate(rotation: 3),
......@@ -79,7 +86,6 @@ class RecipesViewController: UIViewController {
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
// Disable the SideNavigation.
sideNavigationController?.enabled = false
// Hide the menuView.
menuViewController?.menuView.animate(MaterialAnimation.animationGroup([
......@@ -100,7 +106,7 @@ class RecipesViewController: UIViewController {
recommended.append(dataSourceItems[3])
recommended.append(dataSourceItems[5])
let vc: AppSearchBarController = AppSearchBarController(mainViewController: RecommendationViewController(dataSourceItems: recommended))
let vc: AppSearchBarController = AppSearchBarController(rootViewController: RecommendationViewController(dataSourceItems: recommended))
vc.modalTransitionStyle = .CrossDissolve
navigationController?.presentViewController(vc, animated: true, completion: nil)
}
......@@ -155,6 +161,54 @@ class RecipesViewController: UIViewController {
"date": "February 26, 2016",
"image": "VeganPieAbove"
]
),
MaterialDataSourceItem(
data: [
"title": "Crepe Indulgence",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "AssortmentOfDessert"
]
),
MaterialDataSourceItem(
data: [
"title": "Avocado Chocolate Cake",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "AssortmentOfFood"
]
),
MaterialDataSourceItem(
data: [
"title": "Avocado Ice-Cream",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "AvocadoIceCream"
]
),
MaterialDataSourceItem(
data: [
"title": "Raw Vegan Chocolate Cookies",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "HeartCookies"
]
),
MaterialDataSourceItem(
data: [
"title": "Raw Vegan Nutty Sweets",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "VeganHempBalls"
]
),
MaterialDataSourceItem(
data: [
"title": "Blueberry Tart",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "VeganPieAbove"
]
)
]
}
......@@ -174,13 +228,13 @@ class RecipesViewController: UIViewController {
/// Prepares the menuButton.
private func prepareMenuButton() {
let image: UIImage? = MaterialIcon.menu
let image: UIImage? = MaterialIcon.cm.menu
menuButton = FlatButton()
menuButton.pulseScale = false
menuButton.pulseColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal)
menuButton.setImage(image, forState: .Highlighted)
menuButton.addTarget(self, action: "handleMenuButton", forControlEvents: .TouchUpInside)
menuButton.addTarget(self, action: #selector(handleMenuButton), forControlEvents: .TouchUpInside)
}
/// Prepares the switchControl.
......@@ -190,17 +244,17 @@ class RecipesViewController: UIViewController {
/// Prepares the searchButton.
private func prepareSearchButton() {
let image: UIImage? = MaterialIcon.search
let image: UIImage? = MaterialIcon.cm.search
searchButton = FlatButton()
searchButton.pulseScale = false
searchButton.pulseColor = MaterialColor.white
searchButton.setImage(image, forState: .Normal)
searchButton.setImage(image, forState: .Highlighted)
searchButton.addTarget(self, action: "handleSearchButton", forControlEvents: .TouchUpInside)
searchButton.addTarget(self, action: #selector(handleSearchButton), forControlEvents: .TouchUpInside)
}
/// Prepares the NavigationBar.
private func prepareNavigationBar() {
/// Prepares the navigationItem.
private func prepareNavigationItem() {
navigationItem.titleLabel = titleLabel
navigationItem.leftControls = [menuButton]
navigationItem.rightControls = [switchControl, searchButton]
......
......@@ -53,6 +53,7 @@ class RecommendationViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareTableView()
}
......
......@@ -29,12 +29,36 @@
*/
import UIKit
import Material
public extension UIImage {
/**
:name: writeToPhotoLibrary
*/
public func writeToPhotoLibrary(target t: AnyObject? = nil) {
UIImageWriteToSavedPhotosAlbum(self, t, "image:didFinishSavingWithError:contextInfo:", nil)
class VideoViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
\ No newline at end of file
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.yellow.base
}
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = MaterialIcon.cm.videocam
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.white, forState: .Selected)
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:BottomNavigationController.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, UITabBarControllerDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let bottomNavigationController: BottomNavigationController = BottomNavigationController()
bottomNavigationController.viewControllers = [VideoViewController(), PhotoViewController(), LibraryViewController()]
bottomNavigationController.selectedIndex = 0
bottomNavigationController.tabBar.tintColor = MaterialColor.teal.base
bottomNavigationController.tabBar.backgroundColor = MaterialColor.grey.darken4
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = bottomNavigationController
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:.
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Material nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class LibraryViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.blue.base
}
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Library"
tabBarItem.image = MaterialIcon.cm.photoLibrary
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
}
}
......@@ -28,101 +28,38 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
The following is an example of setting a UITableView as the RightViewController
within a SideNavigationController.
*/
import UIKit
import Material
private struct Item {
var text: String
var imageName: String
}
class AppRightViewController: UIViewController {
/// A tableView used to display navigation items.
private let tableView: UITableView = UITableView()
class PhotoViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
/// A list of all the navigation items.
private var items: Array<Item> = Array<Item>()
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareCells()
prepareTableView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.grey.darken4
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
}
/// Prepares the items that are displayed within the tableView.
private func prepareCells() {
items.append(Item(text: "Recipes", imageName: "ic_inbox"))
items.append(Item(text: "Feed", imageName: "ic_today"))
items.append(Item(text: "Bookmarks", imageName: "ic_book"))
items.append(Item(text: "Work", imageName: "ic_work"))
items.append(Item(text: "Contacts", imageName: "ic_contacts"))
items.append(Item(text: "Settings", imageName: "ic_settings"))
}
/// Prepares the tableView.
private func prepareTableView() {
tableView.registerClass(MaterialTableViewCell.self, forCellReuseIdentifier: "MaterialTableViewCell")
tableView.backgroundColor = MaterialColor.clear
tableView.dataSource = self
tableView.delegate = self
tableView.separatorStyle = .None
// Use MaterialLayout to easily align the tableView.
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(view, child: tableView)
}
}
/// TableViewDataSource methods.
extension AppRightViewController: UITableViewDataSource {
/// Determines the number of rows in the tableView.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count;
}
/// Prepares the cells within the tableView.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: MaterialTableViewCell = tableView.dequeueReusableCellWithIdentifier("MaterialTableViewCell", forIndexPath: indexPath) as! MaterialTableViewCell
let item: Item = items[indexPath.row]
cell.textLabel!.text = item.text
cell.textLabel!.textColor = MaterialColor.grey.lighten2
cell.textLabel!.font = RobotoFont.medium
cell.imageView!.image = UIImage(named: item.imageName)?.imageWithRenderingMode(.AlwaysTemplate)
cell.imageView!.tintColor = MaterialColor.grey.lighten2
cell.backgroundColor = MaterialColor.clear
return cell
}
}
/// UITableViewDelegate methods.
extension AppRightViewController: UITableViewDelegate {
/// Sets the tableView cell height.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 64
view.backgroundColor = MaterialColor.green.base
}
/// Select item at row in tableView.
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("Cell selected")
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Photo"
tabBarItem.image = MaterialIcon.cm.photoCamera
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
}
}
......@@ -29,16 +29,37 @@
*/
import UIKit
import Material
public struct MaterialIcon {
public static let add: UIImage? = UIImage(named: "ic_add_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let arrowBack: UIImage? = UIImage(named: "ic_arrow_back_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let arrowDownward: UIImage? = UIImage(named: "ic_arrow_downward_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let clear: UIImage? = UIImage(named: "ic_close_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let close: UIImage? = UIImage(named: "ic_close_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let menu: UIImage? = UIImage(named: "ic_menu_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let moreHorizontal: UIImage? = UIImage(named: "ic_more_horiz_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let moreVertical: UIImage? = UIImage(named: "ic_more_vert_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let search: UIImage? = UIImage(named: "ic_search_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let share: UIImage? = UIImage(named: "ic_share_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
class VideoViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.yellow.base
}
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Video"
tabBarItem.image = MaterialIcon.cm.videocam
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
}
}
......@@ -36,7 +36,6 @@ 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()
......
{
"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>
/*
* 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 {
/// Reference for BottomTabBar.
private var bottomTabBar: BottomTabBar!
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareTabBar()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Prepare tabBar.
private func prepareTabBar() {
bottomTabBar = BottomTabBar()
// tabBar.autoLayoutToSuperview // Set to false if you want to handle the layout yourself.
bottomTabBar.backgroundColor = MaterialColor.grey.darken4
view.addSubview(bottomTabBar)
let videoItem: UITabBarItem = UITabBarItem(title: "Video", image: MaterialIcon.cm.videocam, selectedImage: nil)
videoItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
videoItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
let photoItem: UITabBarItem = UITabBarItem(title: "Photo", image: MaterialIcon.cm.photoCamera, selectedImage: nil)
photoItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
photoItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
let libraryItem: UITabBarItem = UITabBarItem(title: "Library", image: MaterialIcon.cm.photoLibrary, selectedImage: nil)
libraryItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
libraryItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
bottomTabBar.setItems([videoItem, photoItem, libraryItem], animated: true)
bottomTabBar.tintColor = MaterialColor.teal.base // Sets the image color when highlighted.
bottomTabBar.itemPositioning = .Automatic // Sets the alignment of the UITabBarItems.
bottomTabBar.selectedItem = videoItem
}
}
......@@ -37,7 +37,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
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()
......
......@@ -37,7 +37,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
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()
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:ControlView.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>
</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 {
/// Reference for ControlView.
private var controlView: ControlView!
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareControlView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Prepares the controlView
private func prepareControlView() {
controlView = ControlView(frame: CGRectMake(0, view.bounds.height - 56, view.bounds.width, 56))
// Undo button.
let undoButton: FlatButton = FlatButton()
undoButton.pulseScale = false
undoButton.pulseColor = MaterialColor.white
undoButton.setTitle("UNDO", forState: .Normal)
undoButton.setTitleColor(MaterialColor.teal.accent1, forState: .Normal)
let label: UILabel = UILabel()
label.text = "Archived"
label.textColor = MaterialColor.white
controlView.backgroundColor = MaterialColor.grey.darken4
controlView.contentView.addSubview(label)
controlView.rightControls = [undoButton]
controlView.contentInsetPreset = .WideRectangle3
view.addSubview(controlView)
controlView.contentView.grid.views = [label]
}
}
......@@ -37,7 +37,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
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()
......
......@@ -202,7 +202,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel)
image = MaterialIcon.moreVertical
image = MaterialIcon.cm.moreVertical
let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
......@@ -299,7 +299,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel)
image = MaterialIcon.moreVertical
image = MaterialIcon.cm.moreVertical
let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
......@@ -408,7 +408,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel)
image = MaterialIcon.moreHorizontal
image = MaterialIcon.cm.moreHorizontal
let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
......
......@@ -37,7 +37,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
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()
......
......@@ -37,7 +37,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
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()
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:MaterialCollectionView.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
This source diff could not be displayed because it is too large. You can view the blob instead.
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