Commit 056e1524 by Daniel Dahan

updated MaterialIcon to Icon

parent 4eb58244
......@@ -11,9 +11,6 @@
location = "group:Programmatic/App/App.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/MaterialIcon/MaterialIcon.xcodeproj">
</FileRef>
<FileRef
location = "group:Programmatic/Layout/Layout.xcodeproj">
</FileRef>
<FileRef
......
......@@ -71,7 +71,7 @@ class AppBottomNavigationController: BottomNavigationController {
/// Prepares the menuButton.
private func prepareMenuButton() {
let image: UIImage? = MaterialIcon.cm.menu
let image: UIImage? = Icon.cm.menu
menuButton = IconButton()
menuButton.pulseColor = Color.white
menuButton.setImage(image, forState: .Normal)
......@@ -86,7 +86,7 @@ class AppBottomNavigationController: BottomNavigationController {
/// Prepares the searchButton.
private func prepareSearchButton() {
let image: UIImage? = MaterialIcon.cm.search
let image: UIImage? = Icon.cm.search
searchButton = IconButton()
searchButton.pulseColor = Color.white
searchButton.setImage(image, forState: .Normal)
......
......@@ -119,7 +119,7 @@ class AppMenuController: MenuController {
/// Prepares the menuView.
private func prepareMenuView() {
var image: UIImage? = MaterialIcon.cm.add
var image: UIImage? = Icon.cm.add
let menuButton: FabButton = FabButton()
menuButton.tintColor = Color.white
menuButton.setImage(image, forState: .Normal)
......@@ -127,7 +127,7 @@ class AppMenuController: MenuController {
menuButton.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(menuButton)
image = MaterialIcon.cm.pen
image = Icon.cm.pen
let blueButton: FabButton = FabButton()
blueButton.tintColor = Color.white
blueButton.backgroundColor = Color.blue.base
......@@ -136,7 +136,7 @@ class AppMenuController: MenuController {
menuView.addSubview(blueButton)
blueButton.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.photoCamera
image = Icon.cm.photoCamera
let greenButton: FabButton = FabButton()
greenButton.tintColor = Color.white
greenButton.backgroundColor = Color.green.base
......@@ -145,7 +145,7 @@ class AppMenuController: MenuController {
menuView.addSubview(greenButton)
greenButton.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.star
image = Icon.cm.star
let yellowButton: FabButton = FabButton()
yellowButton.tintColor = Color.white
yellowButton.backgroundColor = Color.yellow.base
......
......@@ -74,7 +74,7 @@ class AppSearchBarController: SearchBarController {
/// Prepares the searchBar.
private func prepareSearchBar() {
var image: UIImage? = MaterialIcon.cm.arrowBack
var image: UIImage? = Icon.cm.arrowBack
// Back button.
let backButton: IconButton = IconButton()
......@@ -85,7 +85,7 @@ class AppSearchBarController: SearchBarController {
backButton.addTarget(self, action: #selector(handleBackButton), forControlEvents: .TouchUpInside)
// More button.
image = MaterialIcon.cm.moreHorizontal
image = Icon.cm.moreHorizontal
let moreButton: IconButton = IconButton()
moreButton.pulseColor = Color.grey.base
moreButton.tintColor = Color.grey.darken4
......
......@@ -100,7 +100,7 @@ class ItemViewController: UIViewController {
/// Prepares the shareButton.
private func prepareShareButton() {
let image: UIImage? = MaterialIcon.cm.share
let image: UIImage? = Icon.cm.share
shareButton = IconButton()
shareButton.pulseColor = Color.white
shareButton.setImage(image, forState: .Normal)
......
......@@ -57,7 +57,7 @@ class PhotoViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = MaterialIcon.cm.photoCamera
tabBarItem.image = Icon.cm.photoCamera
tabBarItem.setTitleColor(Color.grey.base, forState: .Normal)
tabBarItem.setTitleColor(Color.white, forState: .Selected)
}
......
......@@ -191,7 +191,7 @@ class RecipesViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = MaterialIcon.cm.photoLibrary
tabBarItem.image = Icon.cm.photoLibrary
tabBarItem.setTitleColor(Color.grey.base, forState: .Normal)
tabBarItem.setTitleColor(Color.white, forState: .Selected)
}
......
......@@ -57,7 +57,7 @@ class VideoViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.image = MaterialIcon.cm.videocam
tabBarItem.image = Icon.cm.videocam
tabBarItem.setTitleColor(Color.grey.base, forState: .Normal)
tabBarItem.setTitleColor(Color.white, forState: .Selected)
}
......
......@@ -58,7 +58,7 @@ class LibraryViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Library"
tabBarItem.image = MaterialIcon.cm.photoLibrary
tabBarItem.image = Icon.cm.photoLibrary
tabBarItem.setTitleColor(Color.grey.base, forState: .Normal)
tabBarItem.setTitleColor(Color.teal.base, forState: .Selected)
}
......
......@@ -58,7 +58,7 @@ class PhotoViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Photo"
tabBarItem.image = MaterialIcon.cm.photoCamera
tabBarItem.image = Icon.cm.photoCamera
tabBarItem.setTitleColor(Color.grey.base, forState: .Normal)
tabBarItem.setTitleColor(Color.teal.base, forState: .Selected)
}
......
......@@ -58,7 +58,7 @@ class VideoViewController: UIViewController {
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Video"
tabBarItem.image = MaterialIcon.cm.videocam
tabBarItem.image = Icon.cm.videocam
tabBarItem.setTitleColor(Color.grey.base, forState: .Normal)
tabBarItem.setTitleColor(Color.teal.base, forState: .Selected)
}
......
......@@ -53,15 +53,15 @@ class ViewController: UIViewController {
bottomTabBar.backgroundColor = Color.grey.darken4
view.addSubview(bottomTabBar)
let videoItem: UITabBarItem = UITabBarItem(title: "Video", image: MaterialIcon.cm.videocam, selectedImage: nil)
let videoItem: UITabBarItem = UITabBarItem(title: "Video", image: Icon.cm.videocam, selectedImage: nil)
videoItem.setTitleColor(Color.grey.base, forState: .Normal)
videoItem.setTitleColor(Color.teal.base, forState: .Selected)
let photoItem: UITabBarItem = UITabBarItem(title: "Photo", image: MaterialIcon.cm.photoCamera, selectedImage: nil)
let photoItem: UITabBarItem = UITabBarItem(title: "Photo", image: Icon.cm.photoCamera, selectedImage: nil)
photoItem.setTitleColor(Color.grey.base, forState: .Normal)
photoItem.setTitleColor(Color.teal.base, forState: .Selected)
let libraryItem: UITabBarItem = UITabBarItem(title: "Library", image: MaterialIcon.cm.photoLibrary, selectedImage: nil)
let libraryItem: UITabBarItem = UITabBarItem(title: "Library", image: Icon.cm.photoLibrary, selectedImage: nil)
libraryItem.setTitleColor(Color.grey.base, forState: .Normal)
libraryItem.setTitleColor(Color.teal.base, forState: .Selected)
......
......@@ -105,7 +105,7 @@ class ViewController: UIViewController {
cardView.contentView = detailLabel
// Share button.
let img1: UIImage? = MaterialIcon.cm.share
let img1: UIImage? = Icon.cm.share
let btn1: IconButton = IconButton()
btn1.pulseColor = Color.white
btn1.tintColor = Color.white
......@@ -143,7 +143,7 @@ class ViewController: UIViewController {
cardView.contentView = detailLabel
// Share button.
let img1: UIImage? = MaterialIcon.cm.share
let img1: UIImage? = Icon.cm.share
let btn1: IconButton = IconButton()
btn1.pulseColor = Color.white
btn1.tintColor = Color.white
......@@ -163,7 +163,7 @@ class ViewController: UIViewController {
cardView.backgroundColor = Color.blueGrey.darken4
// Search button.
let img1: UIImage? = MaterialIcon.cm.search
let img1: UIImage? = Icon.cm.search
let btn1: IconButton = IconButton()
btn1.pulseColor = Color.white
btn1.tintColor = Color.white
......
......@@ -202,7 +202,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = Color.clear
contentView.addSubview(titleLabel)
image = MaterialIcon.cm.moreVertical
image = Icon.cm.moreVertical
let moreButton: IconButton = IconButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = Color.blueGrey.darken4
......@@ -299,7 +299,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = Color.clear
contentView.addSubview(titleLabel)
image = MaterialIcon.cm.moreVertical
image = Icon.cm.moreVertical
let moreButton: IconButton = IconButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = Color.blueGrey.darken4
......@@ -408,7 +408,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = Color.clear
contentView.addSubview(titleLabel)
image = MaterialIcon.cm.moreHorizontal
image = Icon.cm.moreHorizontal
let moreButton: IconButton = IconButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = Color.blueGrey.darken4
......
......@@ -104,7 +104,7 @@ class ViewController: UIViewController {
imageCardView.titleLabelInset.top = 80
// Star button.
let img1: UIImage? = MaterialIcon.cm.star
let img1: UIImage? = Icon.cm.star
let btn1: IconButton = IconButton()
btn1.pulseColor = Color.blueGrey.lighten1
btn1.tintColor = Color.blueGrey.darken3
......@@ -112,7 +112,7 @@ class ViewController: UIViewController {
btn1.setImage(img1, forState: .Highlighted)
// Library button.
let img2: UIImage? = MaterialIcon.cm.audioLibrary
let img2: UIImage? = Icon.cm.audioLibrary
let btn2: IconButton = IconButton()
btn2.pulseColor = Color.blueGrey.lighten1
btn2.tintColor = Color.blueGrey.darken3
......@@ -120,7 +120,7 @@ class ViewController: UIViewController {
btn2.setImage(img2, forState: .Highlighted)
// Share button.
let img3: UIImage? = MaterialIcon.share
let img3: UIImage? = Icon.share
let btn3: IconButton = IconButton()
btn3.pulseColor = Color.blueGrey.lighten1
btn3.tintColor = Color.blueGrey.darken3
......
......@@ -84,7 +84,7 @@ class ViewController: UIViewController {
/// Prepares the FabButton.
private func prepareFabButtonExample() {
let w: CGFloat = 64
let img: UIImage? = MaterialIcon.cm.pen
let img: UIImage? = Icon.cm.pen
let button: FabButton = FabButton(frame: CGRectMake((view.bounds.width - w) / 2, 300, w, w))
button.setImage(img, forState: .Normal)
button.setImage(img, forState: .Highlighted)
......@@ -96,7 +96,7 @@ class ViewController: UIViewController {
/// Prepares the IconButton.
private func prepareIconButtonExample() {
let w: CGFloat = 64
let img: UIImage? = MaterialIcon.cm.search
let img: UIImage? = Icon.cm.search
let button: IconButton = IconButton(frame: CGRectMake((view.bounds.width - w) / 2, 400, w, w))
button.setImage(img, forState: .Normal)
button.setImage(img, forState: .Highlighted)
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:MaterialIcon.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 CosmicMind 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" : "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="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" 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>
</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>
</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 GraphKit 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.
*/
/*
The following is an example of setting a UITableView as the contentView for a
CardView.
*/
import UIKit
import Material
private struct Item {
var name: String
var mdIcon: UIImage?
var cmIcon: UIImage?
}
class ViewController: UIViewController {
/// A tableView used to display Bond entries.
private let tableView: UITableView = UITableView()
/// A list of all the Icons.
private var icons: Array<Item> = Array<Item>()
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareItems()
prepareTableView()
}
/// Prepares view.
private func prepareView() {
view.backgroundColor = Color.white
}
/// Prepares the items Array.
private func prepareItems() {
icons.append(Item(name: "add", mdIcon: MaterialIcon.add, cmIcon: MaterialIcon.cm.add))
icons.append(Item(name: "addCircle", mdIcon: MaterialIcon.addCircle, cmIcon: nil))
icons.append(Item(name: "addCircleOutline", mdIcon: MaterialIcon.addCircleOutline, cmIcon: nil))
icons.append(Item(name: "arrowBack", mdIcon: MaterialIcon.arrowBack, cmIcon: MaterialIcon.cm.arrowBack))
icons.append(Item(name: "arrowDownward", mdIcon: MaterialIcon.arrowDownward, cmIcon: MaterialIcon.cm.arrowDownward))
icons.append(Item(name: "audio", mdIcon: MaterialIcon.audio, cmIcon: MaterialIcon.cm.audio))
icons.append(Item(name: "bell", mdIcon: nil, cmIcon: MaterialIcon.cm.bell))
icons.append(Item(name: "check", mdIcon: MaterialIcon.check, cmIcon: MaterialIcon.cm.check))
icons.append(Item(name: "clear", mdIcon: MaterialIcon.clear, cmIcon: MaterialIcon.cm.clear))
icons.append(Item(name: "close", mdIcon: MaterialIcon.close, cmIcon: MaterialIcon.cm.close))
icons.append(Item(name: "edit", mdIcon: MaterialIcon.edit, cmIcon: MaterialIcon.cm.edit))
icons.append(Item(name: "favorite", mdIcon: MaterialIcon.favorite, cmIcon: nil))
icons.append(Item(name: "favoriteBorder", mdIcon: MaterialIcon.favoriteBorder, cmIcon: nil))
icons.append(Item(name: "history", mdIcon: MaterialIcon.history, cmIcon: nil))
icons.append(Item(name: "home", mdIcon: MaterialIcon.home, cmIcon: nil))
icons.append(Item(name: "image", mdIcon: MaterialIcon.image, cmIcon: MaterialIcon.cm.image))
icons.append(Item(name: "menu", mdIcon: MaterialIcon.menu, cmIcon: MaterialIcon.cm.menu))
icons.append(Item(name: "microphone", mdIcon: nil, cmIcon: MaterialIcon.cm.microphone))
icons.append(Item(name: "moreVertical", mdIcon: MaterialIcon.moreHorizontal, cmIcon: MaterialIcon.cm.moreHorizontal))
icons.append(Item(name: "moreHorizontal", mdIcon: MaterialIcon.moreVertical, cmIcon: MaterialIcon.cm.moreVertical))
icons.append(Item(name: "movie", mdIcon: MaterialIcon.movie, cmIcon: MaterialIcon.cm.movie))
icons.append(Item(name: "pause", mdIcon: nil, cmIcon: MaterialIcon.cm.pause))
icons.append(Item(name: "pen", mdIcon: MaterialIcon.pen, cmIcon: MaterialIcon.cm.pen))
icons.append(Item(name: "place", mdIcon: MaterialIcon.place, cmIcon: nil))
icons.append(Item(name: "photoCamera", mdIcon: MaterialIcon.photoCamera, cmIcon: MaterialIcon.cm.photoCamera))
icons.append(Item(name: "photoLibrary", mdIcon: MaterialIcon.photoLibrary, cmIcon: MaterialIcon.cm.photoLibrary))
icons.append(Item(name: "play", mdIcon: nil, cmIcon: MaterialIcon.cm.play))
icons.append(Item(name: "search", mdIcon: MaterialIcon.search, cmIcon: MaterialIcon.cm.search))
icons.append(Item(name: "settings", mdIcon: MaterialIcon.settings, cmIcon: MaterialIcon.cm.settings))
icons.append(Item(name: "share", mdIcon: MaterialIcon.share, cmIcon: MaterialIcon.cm.share))
icons.append(Item(name: "shuffle", mdIcon: nil, cmIcon: MaterialIcon.cm.shuffle))
icons.append(Item(name: "skipBackward", mdIcon: nil, cmIcon: MaterialIcon.cm.skipBackward))
icons.append(Item(name: "skipForward", mdIcon: nil, cmIcon: MaterialIcon.cm.skipForward))
icons.append(Item(name: "star", mdIcon: MaterialIcon.star, cmIcon: MaterialIcon.cm.star))
icons.append(Item(name: "starBorder", mdIcon: MaterialIcon.starBorder, cmIcon: nil))
icons.append(Item(name: "starHalf", mdIcon: MaterialIcon.starHalf, cmIcon: nil))
icons.append(Item(name: "videocam", mdIcon: MaterialIcon.videocam, cmIcon: MaterialIcon.cm.videocam))
icons.append(Item(name: "visibility", mdIcon: MaterialIcon.visibility, cmIcon: nil))
icons.append(Item(name: "volumeHigh", mdIcon: nil, cmIcon: MaterialIcon.cm.volumeHigh))
icons.append(Item(name: "volumeMedium", mdIcon: nil, cmIcon: MaterialIcon.cm.volumeMedium))
icons.append(Item(name: "volumeOff", mdIcon: nil, cmIcon: MaterialIcon.cm.volumeOff))
}
/// Prepares the tableView.
private func prepareTableView() {
view.layout(tableView).edges(top: 20)
tableView.registerClass(MaterialTableViewCell.self, forCellReuseIdentifier: "Cell")
tableView.dataSource = self
tableView.delegate = self
}
private func image(iconName:String!) -> UIImage? {
return nil
}
}
/// TableViewDataSource methods.
extension ViewController: UITableViewDataSource {
/// Determines the number of rows in the tableView.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return icons.count;
}
/// Returns the number of sections.
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
/// Prepares the cells within the tableView.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: MaterialTableViewCell = MaterialTableViewCell(style: .Subtitle, reuseIdentifier: "Cell")
let item: Item = icons[indexPath.row]
cell.selectionStyle = .None
cell.textLabel!.text = item.name
cell.textLabel!.font = RobotoFont.regular
cell.textLabel?.textAlignment = .Center
cell.imageView!.image = item.mdIcon
cell.imageView!.contentMode = .Center
let imageView: UIImageView = UIImageView(frame: CGRectMake(0, 0, 24, 24))
imageView.image = item.cmIcon
cell.accessoryView = imageView
return cell
}
}
/// UITableViewDelegate methods.
extension ViewController: UITableViewDelegate {
/// Sets the tableView cell height.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 44
}
/// Sets the tableView header height.
func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 40
}
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let v: UIView = UIView()
v.backgroundColor = Color.grey.lighten4
let leftLabel: UILabel = UILabel()
leftLabel.grid.columns = 5
leftLabel.grid.offset.columns = 1
leftLabel.text = "Google Icons"
let rightLabel: UILabel = UILabel()
rightLabel.grid.columns = 5
rightLabel.text = "CosmicMind Icons"
rightLabel.textAlignment = .Right
v.addSubview(leftLabel)
v.addSubview(rightLabel)
v.grid.views = [leftLabel, rightLabel]
return v
}
func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
view.grid.reloadLayout()
}
}
......@@ -80,12 +80,12 @@ class ViewController: UIViewController {
if fabMenu.opened {
fabMenu.close()
image = MaterialIcon.cm.add
image = Icon.cm.add
} else {
fabMenu.open() { (v: UIView) in
(v as? MaterialButton)?.pulse()
}
image = MaterialIcon.cm.close
image = Icon.cm.close
}
// Add a nice rotation animation to the base button.
......
......@@ -108,7 +108,7 @@ class AppMenuController: MenuController {
/// Prepares the add button.
private func prepareMenuView() {
var image: UIImage? = MaterialIcon.cm.add
var image: UIImage? = Icon.cm.add
let menuButton: FabButton = FabButton()
menuButton.tintColor = Color.white
menuButton.setImage(image, forState: .Normal)
......@@ -116,7 +116,7 @@ class AppMenuController: MenuController {
menuButton.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(menuButton)
image = MaterialIcon.cm.pen
image = Icon.cm.pen
let blueButton: FabButton = FabButton()
blueButton.tintColor = Color.white
blueButton.backgroundColor = Color.blue.base
......@@ -125,7 +125,7 @@ class AppMenuController: MenuController {
menuView.addSubview(blueButton)
blueButton.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.photoCamera
image = Icon.cm.photoCamera
let greenButton: FabButton = FabButton()
greenButton.tintColor = Color.white
greenButton.backgroundColor = Color.green.base
......@@ -134,7 +134,7 @@ class AppMenuController: MenuController {
menuView.addSubview(greenButton)
greenButton.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
image = MaterialIcon.cm.star
image = Icon.cm.star
let yellowButton: FabButton = FabButton()
yellowButton.tintColor = Color.white
yellowButton.backgroundColor = Color.yellow.base
......
......@@ -58,7 +58,7 @@ class ViewController: UIViewController {
/// Prepares the menuButton.
private func prepareMenuButton() {
let image: UIImage? = MaterialIcon.cm.menu
let image: UIImage? = Icon.cm.menu
menuButton = IconButton()
menuButton.pulseColor = Color.white
menuButton.setImage(image, forState: .Normal)
......@@ -72,7 +72,7 @@ class ViewController: UIViewController {
/// Prepares the searchButton.
private func prepareSearchButton() {
let image: UIImage? = MaterialIcon.cm.search
let image: UIImage? = Icon.cm.search
searchButton = IconButton()
searchButton.pulseColor = Color.white
searchButton.setImage(image, forState: .Normal)
......
......@@ -58,10 +58,10 @@ class AppLeftViewController: UIViewController {
/// Prepares the items that are displayed within the tableView.
private func prepareCells() {
dataSourceItems = Array<Item>()
dataSourceItems.append(Item(text: "Orange", image: MaterialIcon.cm.audioLibrary))
dataSourceItems.append(Item(text: "Purple", image: MaterialIcon.cm.photoLibrary))
dataSourceItems.append(Item(text: "Green", image: MaterialIcon.cm.microphone))
dataSourceItems.append(Item(text: "Blue", image: MaterialIcon.cm.audio))
dataSourceItems.append(Item(text: "Orange", image: Icon.cm.audioLibrary))
dataSourceItems.append(Item(text: "Purple", image: Icon.cm.photoLibrary))
dataSourceItems.append(Item(text: "Green", image: Icon.cm.microphone))
dataSourceItems.append(Item(text: "Blue", image: Icon.cm.audio))
}
/// Prepares the tableView.
......
......@@ -71,7 +71,7 @@ class YellowViewController: UIViewController {
/// Prepares the menuButton.
private func prepareMenuButton() {
let image: UIImage? = MaterialIcon.cm.menu
let image: UIImage? = Icon.cm.menu
menuButton = IconButton()
menuButton.pulseColor = Color.white
menuButton.setImage(image, forState: .Normal)
......@@ -86,7 +86,7 @@ class YellowViewController: UIViewController {
/// Prepares the searchButton.
private func prepareSearchButton() {
let image: UIImage? = MaterialIcon.cm.moreVertical
let image: UIImage? = Icon.cm.moreVertical
moreButton = IconButton()
moreButton.pulseColor = Color.white
moreButton.setImage(image, forState: .Normal)
......
......@@ -67,7 +67,7 @@ class ViewController: UIViewController {
searchBar = SearchBar()
containerView.addSubview(searchBar)
let image: UIImage? = MaterialIcon.cm.moreVertical
let image: UIImage? = Icon.cm.moreVertical
// More button.
let moreButton: IconButton = IconButton()
......
......@@ -46,7 +46,7 @@ class AppSearchBarController: SearchBarController {
/// Prepares the searchBar.
private func prepareSearchBar() {
var image: UIImage? = MaterialIcon.cm.arrowBack
var image: UIImage? = Icon.cm.arrowBack
// Back button.
let backButton: IconButton = IconButton()
......@@ -55,7 +55,7 @@ class AppSearchBarController: SearchBarController {
backButton.setImage(image, forState: .Highlighted)
// More button.
image = MaterialIcon.cm.moreHorizontal
image = Icon.cm.moreHorizontal
let moreButton: IconButton = IconButton()
moreButton.tintColor = Color.blueGrey.darken4
moreButton.setImage(image, forState: .Normal)
......
......@@ -105,7 +105,7 @@ class ViewController: UIViewController {
closeButton.setTitle("Close", forState: .Normal)
closeButton.setTitleColor(Color.blue.accent3, forState: .Normal)
let image: UIImage? = MaterialIcon.cm.settings
let image: UIImage? = Icon.cm.settings
let settingButton: IconButton = IconButton()
settingButton.tintColor = Color.blue.accent3
settingButton.setImage(image, forState: .Normal)
......
......@@ -75,7 +75,7 @@ class ViewController: UIViewController {
toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textColor = Color.white
var image: UIImage? = MaterialIcon.cm.menu
var image: UIImage? = Icon.cm.menu
// Menu button.
let menuButton: IconButton = IconButton()
......@@ -88,7 +88,7 @@ class ViewController: UIViewController {
let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .LightContent, size: .Small)
// Search button.
image = MaterialIcon.cm.search
image = Icon.cm.search
let searchButton: IconButton = IconButton()
searchButton.pulseColor = Color.white
searchButton.tintColor = Color.white
......
......@@ -69,7 +69,7 @@ class AppToolbarController: ToolbarController {
toolbar.detailLabel.textAlignment = .Left
toolbar.detailLabel.textColor = Color.white
var image: UIImage? = MaterialIcon.cm.menu
var image: UIImage? = Icon.cm.menu
// Menu button.
let menuButton: IconButton = IconButton()
......@@ -83,7 +83,7 @@ class AppToolbarController: ToolbarController {
let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .LightContent, size: .Small)
// Search button.
image = MaterialIcon.cm.search
image = Icon.cm.search
let searchButton: IconButton = IconButton()
searchButton.tintColor = Color.white
searchButton.pulseColor = Color.white
......
......@@ -37,15 +37,15 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let videoItem: UITabBarItem = UITabBarItem(title: "Video", image: MaterialIcon.cm.videocam, selectedImage: nil)
let videoItem: UITabBarItem = UITabBarItem(title: "Video", image: Icon.cm.videocam, selectedImage: nil)
videoItem.setTitleColor(Color.grey.base, forState: .Normal)
videoItem.setTitleColor(Color.teal.base, forState: .Selected)
let photoItem: UITabBarItem = UITabBarItem(title: "Photo", image: MaterialIcon.cm.photoCamera, selectedImage: nil)
let photoItem: UITabBarItem = UITabBarItem(title: "Photo", image: Icon.cm.photoCamera, selectedImage: nil)
photoItem.setTitleColor(Color.grey.base, forState: .Normal)
photoItem.setTitleColor(Color.teal.base, forState: .Selected)
let libraryItem: UITabBarItem = UITabBarItem(title: "Library", image: MaterialIcon.cm.photoLibrary, selectedImage: nil)
let libraryItem: UITabBarItem = UITabBarItem(title: "Library", image: Icon.cm.photoLibrary, selectedImage: nil)
libraryItem.setTitleColor(Color.grey.base, forState: .Normal)
libraryItem.setTitleColor(Color.teal.base, forState: .Selected)
......
......@@ -60,7 +60,7 @@ class ViewController: UIViewController {
topCardView.titleLabelInset.top = 80
// Star button.
let img1: UIImage? = MaterialIcon.cm.star
let img1: UIImage? = Icon.cm.star
let btn1: IconButton = IconButton()
btn1.pulseColor = Color.blueGrey.lighten1
btn1.tintColor = Color.blueGrey.lighten1
......@@ -68,7 +68,7 @@ class ViewController: UIViewController {
btn1.setImage(img1, forState: .Highlighted)
// Bell button.
let img2: UIImage? = MaterialIcon.cm.bell
let img2: UIImage? = Icon.cm.bell
let btn2: IconButton = IconButton()
btn2.pulseColor = Color.blueGrey.lighten1
btn2.tintColor = Color.blueGrey.lighten1
......@@ -76,7 +76,7 @@ class ViewController: UIViewController {
btn2.setImage(img2, forState: .Highlighted)
// Share button.
let img3: UIImage? = MaterialIcon.cm.share
let img3: UIImage? = Icon.cm.share
let btn3: IconButton = IconButton()
btn3.pulseColor = Color.blueGrey.lighten1
btn3.tintColor = Color.blueGrey.lighten1
......
......@@ -68,7 +68,7 @@ class ViewController: UIViewController {
:description: General preparation statements.
*/
func prepareFabButtonExample() {
let img: UIImage? = MaterialIcon.cm.edit
let img: UIImage? = Icon.cm.edit
fabButton.setImage(img, forState: .Normal)
fabButton.setImage(img, forState: .Highlighted)
fabButton.tintColor = Color.white
......
......@@ -74,7 +74,7 @@ class ViewController: UIViewController {
toolbar.detailLabel.textColor = Color.white
// Menu button.
let img1: UIImage? = MaterialIcon.cm.menu
let img1: UIImage? = Icon.cm.menu
let btn1: IconButton = IconButton()
btn1.pulseColor = Color.white
btn1.tintColor = Color.white
......@@ -82,7 +82,7 @@ class ViewController: UIViewController {
btn1.setImage(img1, forState: .Highlighted)
// Star button.
let img2: UIImage? = MaterialIcon.cm.star
let img2: UIImage? = Icon.cm.star
let btn2: IconButton = IconButton()
btn2.pulseColor = Color.white
btn2.tintColor = Color.white
......@@ -90,7 +90,7 @@ class ViewController: UIViewController {
btn2.setImage(img2, forState: .Highlighted)
// Search button.
let img3: UIImage? = MaterialIcon.cm.search
let img3: UIImage? = Icon.cm.search
let btn3: IconButton = IconButton()
btn3.pulseColor = Color.white
btn3.tintColor = Color.white
......
......@@ -435,7 +435,7 @@ public class NavigationBar : UINavigationBar {
spacingPreset = .Spacing1
contentInsetPreset = .Square1
contentScaleFactor = MaterialDevice.scale
backButtonImage = MaterialIcon.cm.arrowBack
backButtonImage = Icon.cm.arrowBack
let image: UIImage? = UIImage.imageWithColor(Color.clear, size: CGSizeMake(1, 1))
shadowImage = image
setBackgroundImage(image, forBarMetrics: .Default)
......
......@@ -159,7 +159,7 @@ public class SearchBar : BarView {
/// Prepares the clearButton.
private func prepareClearButton() {
let image: UIImage? = MaterialIcon.cm.close
let image: UIImage? = Icon.cm.close
clearButton = IconButton()
clearButton.contentEdgeInsets = UIEdgeInsetsZero
clearButton.tintColor = placeholderColor
......
......@@ -258,7 +258,7 @@ public class TextField : UITextField {
set(value) {
if value {
if nil == clearIconButton {
let image: UIImage? = MaterialIcon.cm.clear
let image: UIImage? = Icon.cm.clear
clearIconButton = IconButton(frame: CGRect.zero)
clearIconButton!.contentEdgeInsets = UIEdgeInsetsZero
clearIconButton!.pulseAnimation = .Center
......@@ -295,7 +295,7 @@ public class TextField : UITextField {
set(value) {
if value {
if nil == visibilityIconButton {
let image: UIImage? = MaterialIcon.visibility
let image: UIImage? = Icon.visibility
visibilityIconButton = IconButton(frame: CGRect.zero)
visibilityIconButton!.contentEdgeInsets = UIEdgeInsetsZero
visibilityIconButton!.pulseAnimation = .Center
......
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