Commit 38e92483 by Daniel Dahan

updated Storyboards NavigationBarView example

parent 3419d84a
...@@ -13,12 +13,9 @@ ...@@ -13,12 +13,9 @@
9642FA251C1B50E700022BC6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9642FA231C1B50E700022BC6 /* LaunchScreen.storyboard */; }; 9642FA251C1B50E700022BC6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9642FA231C1B50E700022BC6 /* LaunchScreen.storyboard */; };
9642FA331C1B909700022BC6 /* LeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9642FA321C1B909700022BC6 /* LeftViewController.swift */; }; 9642FA331C1B909700022BC6 /* LeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9642FA321C1B909700022BC6 /* LeftViewController.swift */; };
967585381C569AA9001E4268 /* RightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967585371C569AA9001E4268 /* RightViewController.swift */; }; 967585381C569AA9001E4268 /* RightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967585371C569AA9001E4268 /* RightViewController.swift */; };
96A71F271C7275F200C0C4AE /* FeedCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F261C7275F200C0C4AE /* FeedCollectionView.swift */; };
96A71F291C72761700C0C4AE /* FeedCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F281C72761700C0C4AE /* FeedCollectionViewLayout.swift */; };
96A71F2B1C72766700C0C4AE /* FeedCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F2A1C72766700C0C4AE /* FeedCollectionViewCell.swift */; };
96A71F321C73607B00C0C4AE /* FeedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F311C73607B00C0C4AE /* FeedViewController.swift */; };
96A71F3C1C739D1E00C0C4AE /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96A71F3B1C739D1E00C0C4AE /* Material.framework */; }; 96A71F3C1C739D1E00C0C4AE /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96A71F3B1C739D1E00C0C4AE /* Material.framework */; };
96A71F3D1C739D1E00C0C4AE /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96A71F3B1C739D1E00C0C4AE /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 96A71F3D1C739D1E00C0C4AE /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96A71F3B1C739D1E00C0C4AE /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96A71F471C74AD0700C0C4AE /* FeedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F461C74AD0700C0C4AE /* FeedViewController.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -44,11 +41,8 @@ ...@@ -44,11 +41,8 @@
9642FA261C1B50E700022BC6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 9642FA261C1B50E700022BC6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9642FA321C1B909700022BC6 /* LeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftViewController.swift; sourceTree = "<group>"; }; 9642FA321C1B909700022BC6 /* LeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftViewController.swift; sourceTree = "<group>"; };
967585371C569AA9001E4268 /* RightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RightViewController.swift; sourceTree = "<group>"; }; 967585371C569AA9001E4268 /* RightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RightViewController.swift; sourceTree = "<group>"; };
96A71F261C7275F200C0C4AE /* FeedCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedCollectionView.swift; sourceTree = "<group>"; };
96A71F281C72761700C0C4AE /* FeedCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedCollectionViewLayout.swift; sourceTree = "<group>"; };
96A71F2A1C72766700C0C4AE /* FeedCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedCollectionViewCell.swift; sourceTree = "<group>"; };
96A71F311C73607B00C0C4AE /* FeedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedViewController.swift; sourceTree = "<group>"; };
96A71F3B1C739D1E00C0C4AE /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; }; 96A71F3B1C739D1E00C0C4AE /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
96A71F461C74AD0700C0C4AE /* FeedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -87,10 +81,7 @@ ...@@ -87,10 +81,7 @@
9642FA1C1C1B50E700022BC6 /* AppViewController.swift */, 9642FA1C1C1B50E700022BC6 /* AppViewController.swift */,
9642FA321C1B909700022BC6 /* LeftViewController.swift */, 9642FA321C1B909700022BC6 /* LeftViewController.swift */,
967585371C569AA9001E4268 /* RightViewController.swift */, 967585371C569AA9001E4268 /* RightViewController.swift */,
96A71F311C73607B00C0C4AE /* FeedViewController.swift */, 96A71F461C74AD0700C0C4AE /* FeedViewController.swift */,
96A71F261C7275F200C0C4AE /* FeedCollectionView.swift */,
96A71F281C72761700C0C4AE /* FeedCollectionViewLayout.swift */,
96A71F2A1C72766700C0C4AE /* FeedCollectionViewCell.swift */,
9642FA211C1B50E700022BC6 /* Assets.xcassets */, 9642FA211C1B50E700022BC6 /* Assets.xcassets */,
9642FA231C1B50E700022BC6 /* LaunchScreen.storyboard */, 9642FA231C1B50E700022BC6 /* LaunchScreen.storyboard */,
9642FA261C1B50E700022BC6 /* Info.plist */, 9642FA261C1B50E700022BC6 /* Info.plist */,
...@@ -170,12 +161,9 @@ ...@@ -170,12 +161,9 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9642FA1D1C1B50E700022BC6 /* AppViewController.swift in Sources */, 9642FA1D1C1B50E700022BC6 /* AppViewController.swift in Sources */,
96A71F271C7275F200C0C4AE /* FeedCollectionView.swift in Sources */,
967585381C569AA9001E4268 /* RightViewController.swift in Sources */, 967585381C569AA9001E4268 /* RightViewController.swift in Sources */,
96A71F471C74AD0700C0C4AE /* FeedViewController.swift in Sources */,
9642FA331C1B909700022BC6 /* LeftViewController.swift in Sources */, 9642FA331C1B909700022BC6 /* LeftViewController.swift in Sources */,
96A71F291C72761700C0C4AE /* FeedCollectionViewLayout.swift in Sources */,
96A71F2B1C72766700C0C4AE /* FeedCollectionViewCell.swift in Sources */,
96A71F321C73607B00C0C4AE /* FeedViewController.swift in Sources */,
9642FA1B1C1B50E700022BC6 /* AppDelegate.swift in Sources */, 9642FA1B1C1B50E700022BC6 /* AppDelegate.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
......
/*
* 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 FeedCollectionView : UICollectionView {
//
// :name: init
//
internal required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
//
// :name: init
//
internal override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
super.init(frame: frame, collectionViewLayout: layout)
prepareView()
}
//
// :name: prepareView
//
internal func prepareView() {
registerClass(FeedCollectionViewCell.self, forCellWithReuseIdentifier: "FeedCollectionViewCell")
backgroundColor = MaterialColor.clear
contentInset = UIEdgeInsetsMake(4, 0, 0, 0)
}
}
/*
* 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 FeedCollectionViewCell : MaterialCollectionViewCell {
let titleLabel: UILabel = UILabel()
let detailLabel: UILabel = UILabel()
let imageView: MaterialView = MaterialView()
var images: Array<UIImage?>?
override init(frame: CGRect) {
super.init(frame: frame)
prepareView()
}
convenience init() {
self.init(frame: CGRectNull)
prepareView()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func prepareView() {
backgroundColor = MaterialColor.white
pulseScale = false
pulseColor = MaterialColor.blue.lighten4
// var image: UIImage?
contentView.addSubview(imageView)
titleLabel.textColor = MaterialColor.blueGrey.darken4
titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel)
// image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate)
// let moreButton: FlatButton = FlatButton()
// moreButton.contentEdgeInsetsPreset = .None
// moreButton.pulseColor = MaterialColor.blueGrey.darken4
// moreButton.tintColor = MaterialColor.blueGrey.darken4
// moreButton.setImage(image, forState: .Normal)
// moreButton.setImage(image, forState: .Highlighted)
// addSubview(moreButton)
// detailLabel.numberOfLines = 0
// detailLabel.lineBreakMode = .ByTruncatingTail
// detailLabel.font = RobotoFont.regularWithSize(12)
// detailLabel.textColor = MaterialColor.blueGrey.darken4
// detailLabel.backgroundColor = MaterialColor.clear
// addSubview(detailLabel)
let g: Int = Int(bounds.width / 48)
switch UIDevice.currentDevice().orientation {
case .LandscapeLeft, .LandscapeRight:
contentView.grid.axis.direction = .None
contentView.grid.columns = g
contentView.grid.views = [
imageView
]
if let v: Array<UIImage?> = images {
let topImageView: MaterialView = MaterialView()
imageView.addSubview(topImageView)
topImageView.image = v.first!
topImageView.grid.rows = 6
topImageView.grid.columns = 6
let bottomImageView: MaterialView = MaterialView()
imageView.addSubview(bottomImageView)
bottomImageView.image = v.last!
bottomImageView.grid.rows = 6
bottomImageView.grid.columns = 6
imageView.grid.views = [
topImageView,
bottomImageView
]
}
default:
for v in imageView.subviews {
v.removeFromSuperview()
}
imageView.contentsGravity = .ResizeAspectFill
imageView.grid.columns = 2
titleLabel.grid.columns = g - 2
// moreButton.grid.rows = 4
// moreButton.grid.columns = 2
// moreButton.grid.offset.columns = 8
detailLabel.grid.rows = 7
detailLabel.grid.offset.rows = 4
detailLabel.grid.columns = 7
detailLabel.grid.offset.columns = 1
// grid.axis.columns = g
// grid.axis.inherited = false
// grid.views = [
// imageView,
// contentView
// ]
contentView.grid.columns = g
contentView.grid.views = [
imageView,
titleLabel
]
}
}
}
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Material nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
class FeedCollectionViewLayout : UICollectionViewLayout {
private var contentSize: CGSize = CGSizeZero
private var layoutItems: Array<(UICollectionViewLayoutAttributes, NSIndexPath)>?
internal var height: CGFloat = 96
internal var offset: CGFloat = 4
override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
let attributes: UICollectionViewLayoutAttributes = UICollectionViewLayoutAttributes(forCellWithIndexPath: indexPath)
switch UIDevice.currentDevice().orientation {
case .LandscapeLeft, .LandscapeRight:
height = UIScreen.mainScreen().bounds.height - 44
default:
height = 96
}
let w: CGFloat = collectionView!.bounds.width
let r: CGFloat = CGFloat(indexPath.row)
attributes.frame = CGRectMake(0, r * CGFloat(height + (0 < r ? offset : 0)), w, height)
return attributes
}
override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
var layoutAttributes: Array<UICollectionViewLayoutAttributes> = Array<UICollectionViewLayoutAttributes>()
for (attribute, _) in layoutItems! {
if CGRectIntersectsRect(rect, attribute.frame) {
layoutAttributes.append(attribute)
}
}
return layoutAttributes
}
override func shouldInvalidateLayoutForBoundsChange(newBounds: CGRect) -> Bool {
return newBounds.width != collectionView!.bounds.width
}
override func collectionViewContentSize() -> CGSize {
return contentSize
}
override func prepareLayout() {
let dataSource: FeedViewController = collectionView!.dataSource as! FeedViewController
let items: Array<Item> = dataSource.items
layoutItems = Array<(UICollectionViewLayoutAttributes, NSIndexPath)>()
var indexPath: NSIndexPath?
var count: Int = 0
for _ in items {
indexPath = NSIndexPath(forItem: count++, inSection: 0)
layoutItems?.append((layoutAttributesForItemAtIndexPath(indexPath!)!, indexPath!))
}
let w: CGFloat = collectionView!.bounds.width
contentSize = CGSizeMake(w, CGFloat(layoutItems!.count) * (height + offset))
}
override func targetContentOffsetForProposedContentOffset(proposedContentOffset: CGPoint) -> CGPoint {
return proposedContentOffset
}
internal func indexPathsOfItemsInRect(rect: CGRect) -> Array<NSIndexPath> {
var paths: Array<NSIndexPath> = Array<NSIndexPath>()
for (attribute, indexPath) in layoutItems! {
if CGRectIntersectsRect(rect, attribute.frame) {
paths.append(indexPath)
}
}
return paths
}
}
...@@ -28,136 +28,123 @@ ...@@ -28,136 +28,123 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/*
The following is an example of setting a UITableView as the MainViewController
within a SideNavigationViewController. There is a NavigationBarView that is
used for navigation, with a menu button that opens the
SideNavigationViewController.
*/
import UIKit import UIKit
import Material import Material
struct Item { private struct Item {
var title: String var text: String
var detail: String var detail: String
var image: UIImage? var image: UIImage?
var images: Array<UIImage?>?
} }
class FeedViewController: UIViewController { class FeedViewController: UIViewController {
/// A tableView used to display Bond entries. /// A tableView used to display Bond entries.
private lazy var collectionView: FeedCollectionView = FeedCollectionView(frame: CGRectNull, collectionViewLayout: FeedCollectionViewLayout()) private let tableView: UITableView = UITableView()
/// Feed items. /// A list of all the Author Bond types.
private(set) lazy var items: Array<Item> = Array<Item>() private var items: Array<Item> = Array<Item>()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareItems() prepareItems()
prepareCollectionView() prepareTableView()
} }
override func viewWillLayoutSubviews() { /**
super.viewWillLayoutSubviews() Handles the search button click, which opens the
collectionView.reloadData() SideNavigationViewController.
*/
func handleSearchButton() {
sideNavigationViewController?.openRightView()
} }
/// Prepares view. /// Prepares view.
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.white view.backgroundColor = MaterialColor.white
} }
/// Prepares the items Array. /// Prepares the items Array.
private func prepareItems() { private func prepareItems() {
items.append(Item( items.append(Item(text: "Summer BBQ", detail: "Wish I could come, but I am out of town this weekend.", image: UIImage(named: "Profile1")))
title: "Raw Vegan Blackberry Tart!", items.append(Item(text: "Birthday gift", detail: "Have any ideas about what we should get Heidi for her birthday?", image: UIImage(named: "Profile2")))
detail: "Treat yourself today and every day with this sweet nutritious cake!", items.append(Item(text: "Brunch this weekend?", detail: "I'll be in your neighborhood doing errands this weekend.", image: UIImage(named: "Profile3")))
image: UIImage(named: "VeganCakeFull"), items.append(Item(text: "Giants game", detail: "Are we on this weekend for the game?", image: UIImage(named: "Profile4")))
images: [UIImage(named: "VeganCakeFull"), UIImage(named: "VeganCakeFull")] items.append(Item(text: "Recipe to try", detail: "We should eat this: Squash, Corn and tomatillo Tacos.", image: UIImage(named: "Profile5")))
)) items.append(Item(text: "Interview", detail: "The candidate will be arriving at 11:30, are you free?", image: UIImage(named: "Profile6")))
items.append(Item(text: "Book recommendation", detail: "I found the book title, Surely You’re Joking, Mr. Feynman!", image: UIImage(named: "Profile7")))
items.append(Item( items.append(Item(text: "Oui oui", detail: "Do you have Paris recommendations? Have you ever been?", image: UIImage(named: "Profile8")))
title: "Raw Vegan Pumpkin Pie",
detail: "Pumpkin lovers, desert lovers, and anyone who likes simple healthy cooking and enjoys eating! Light up your day with a piece of happiness- raw vegan pumpkin pie :)",
image: UIImage(named: "VeganPieAbove"),
images: [UIImage(named: "VeganCakeFull"), UIImage(named: "VeganCakeFull")]
))
items.append(Item(
title: "Raw Vegan Nutty Sweets!",
detail: "Since most of my readers have a sweet tooth, here is another simple recipe to boost your happiness :)",
image: UIImage(named: "VeganHempBalls"),
images: [UIImage(named: "VeganCakeFull"), UIImage(named: "VeganCakeFull")]
))
items.append(Item(
title: "Avocado Chocolate Cake!",
detail: "Do you know what are the two best things about vegan food besides that it's healthy and full of nutrition? It's absolutely delicious and easy to make!",
image: UIImage(named: "AssortmentOfFood"),
images: [UIImage(named: "VeganCakeFull"), UIImage(named: "VeganCakeFull")]
))
items.append(Item(
title: "Homemade brunch: Crepe Indulgence",
detail: "Looking for a perfect sunday brunch spot? How about staying in and making something to die for?:)",
image: UIImage(named: "AssortmentOfDessert"),
images: [UIImage(named: "VeganCakeFull"), UIImage(named: "VeganCakeFull")]
))
items.append(Item(
title: "Raw Vegan Chocolate Cookies",
detail: "Once I start making sweets it's hard for me to stop! I've got another exciting recipe, which hopefully you will love! :D",
image: UIImage(named: "HeartCookies"),
images: [UIImage(named: "VeganCakeFull"), UIImage(named: "VeganCakeFull")]
))
items.append(Item(
title: "Homemade Avocado Ice Cream",
detail: "Avocado ice cream (and vegan!) might not sound so appealing to some of you, but the truth is- it's mind blowing!!!",
image: UIImage(named: "AvocadoIceCream"),
images: [UIImage(named: "VeganCakeFull"), UIImage(named: "VeganCakeFull")]
))
} }
/// Prepares the tableView. /// Prepares the tableView.
private func prepareCollectionView() { private func prepareTableView() {
collectionView.delegate = self tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell")
collectionView.dataSource = self tableView.dataSource = self
collectionView.backgroundColor = MaterialColor.grey.lighten4 tableView.delegate = self
collectionView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(collectionView) // Use MaterialLayout to easily align the tableView.
MaterialLayout.alignToParent(view, child: collectionView) view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(view, child: tableView)
} }
} }
/// UICollectionViewDelegate /// TableViewDataSource methods.
extension FeedViewController: UICollectionViewDelegate { extension FeedViewController: UITableViewDataSource {
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { /// Determines the number of rows in the tableView.
let c: FeedCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("FeedCollectionViewCell", forIndexPath: indexPath) as! FeedCollectionViewCell func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.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: UITableViewCell = UITableViewCell(style: .Subtitle, reuseIdentifier: "Cell")
let item: Item = items[indexPath.row] as Item let item: Item = items[indexPath.row]
c.titleLabel.text = item.title cell.selectionStyle = .None
c.detailLabel.text = item.detail cell.textLabel!.text = item.text
c.imageView.image = item.image cell.textLabel!.font = RobotoFont.regular
c.images = item.images cell.detailTextLabel!.text = item.detail
c.grid.reloadLayout() cell.detailTextLabel!.font = RobotoFont.regular
cell.detailTextLabel!.textColor = MaterialColor.grey.darken1
cell.imageView!.image = item.image?.resize(toWidth: 40)
cell.imageView!.layer.cornerRadius = 20
return c return cell
}
/// Prepares the header within the tableView.
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = UIView(frame: CGRectMake(0, 0, view.bounds.width, 48))
header.backgroundColor = MaterialColor.white
let label: UILabel = UILabel()
label.font = RobotoFont.medium
label.textColor = MaterialColor.grey.darken1
label.text = "Today"
header.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(header, child: label, left: 24)
return header
} }
} }
/// UICollectionViewDataSource /// UITableViewDelegate methods.
extension FeedViewController: UICollectionViewDataSource { extension FeedViewController: UITableViewDelegate {
/// Number of sections in the collection. /// Sets the tableView cell height.
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 1 return 80
} }
/// Number of items in each section. /// Sets the tableView header height.
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return items.count return 48
} }
} }
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
96A71F4C1C74B1AB00C0C4AE /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96A71F4B1C74B1AB00C0C4AE /* Material.framework */; };
96A71F4D1C74B1AB00C0C4AE /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96A71F4B1C74B1AB00C0C4AE /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9ABEC5151C15085400F6895E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABEC5141C15085400F6895E /* AppDelegate.swift */; }; 9ABEC5151C15085400F6895E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABEC5141C15085400F6895E /* AppDelegate.swift */; };
9ABEC5171C15085400F6895E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABEC5161C15085400F6895E /* ViewController.swift */; }; 9ABEC5171C15085400F6895E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABEC5161C15085400F6895E /* ViewController.swift */; };
9ABEC51A1C15085400F6895E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9ABEC5181C15085400F6895E /* Main.storyboard */; }; 9ABEC51A1C15085400F6895E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9ABEC5181C15085400F6895E /* Main.storyboard */; };
...@@ -21,6 +23,7 @@ ...@@ -21,6 +23,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96A71F4D1C74B1AB00C0C4AE /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -28,6 +31,7 @@ ...@@ -28,6 +31,7 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
96A71F4B1C74B1AB00C0C4AE /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
9ABEC5111C15085400F6895E /* NavigationBarView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationBarView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9ABEC5111C15085400F6895E /* NavigationBarView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationBarView.app; sourceTree = BUILT_PRODUCTS_DIR; };
9ABEC5141C15085400F6895E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 9ABEC5141C15085400F6895E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9ABEC5161C15085400F6895E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 9ABEC5161C15085400F6895E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
...@@ -42,6 +46,7 @@ ...@@ -42,6 +46,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96A71F4C1C74B1AB00C0C4AE /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -51,6 +56,7 @@ ...@@ -51,6 +56,7 @@
9ABEC5081C15085400F6895E = { 9ABEC5081C15085400F6895E = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96A71F4B1C74B1AB00C0C4AE /* Material.framework */,
9ABEC5131C15085400F6895E /* NavigationBarView */, 9ABEC5131C15085400F6895E /* NavigationBarView */,
9ABEC5121C15085400F6895E /* Products */, 9ABEC5121C15085400F6895E /* Products */,
); );
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--View Controller--> <!--View Controller-->
...@@ -17,19 +17,13 @@ ...@@ -17,19 +17,13 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="est-za-GAc" customClass="NavigationBarView" customModule="Material"> <view contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="est-za-GAc" customClass="NavigationBarView" customModule="Material">
<rect key="frame" x="0.0" y="0.0" width="600" height="60"/> <rect key="frame" x="0.0" y="0.0" width="600" height="64"/>
<animations/>
<color key="backgroundColor" red="0.39222975830000001" green="0.2440954615" blue="0.68699765469999996" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.39222975830000001" green="0.2440954615" blue="0.68699765469999996" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="60" id="bb3-sb-PqQ"/>
</constraints>
</view> </view>
</subviews> </subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="est-za-GAc" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="2ou-gk-Aka"/>
<constraint firstItem="est-za-GAc" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="AUy-Kc-64K"/> <constraint firstItem="est-za-GAc" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="AUy-Kc-64K"/>
<constraint firstAttribute="trailing" secondItem="est-za-GAc" secondAttribute="trailing" id="y7B-6P-HG1"/> <constraint firstAttribute="trailing" secondItem="est-za-GAc" secondAttribute="trailing" id="y7B-6P-HG1"/>
</constraints> </constraints>
......
...@@ -37,26 +37,18 @@ class ViewController: UIViewController { ...@@ -37,26 +37,18 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView()
// Examples of using NavigationBarView prepareNavigationBarView()
prepareNavigationBarViewExample()
} }
/** /// General preparation statements.
:name: prepareView
:description: General preparation statements.
*/
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.white view.backgroundColor = MaterialColor.white
} }
/** /// Prepare the navigationBarView.
:name: prepareNavigationBarViewExample func prepareNavigationBarView() {
:description: General usage example. // Stylize.
*/
func prepareNavigationBarViewExample() {
// Stylize.
navigationBarView.backgroundColor = MaterialColor.indigo.darken1 navigationBarView.backgroundColor = MaterialColor.indigo.darken1
// To lighten the status bar add the "View controller-based status bar appearance = NO" // To lighten the status bar add the "View controller-based status bar appearance = NO"
...@@ -68,10 +60,9 @@ class ViewController: UIViewController { ...@@ -68,10 +60,9 @@ class ViewController: UIViewController {
titleLabel.text = "Material" titleLabel.text = "Material"
titleLabel.textAlignment = .Left titleLabel.textAlignment = .Left
titleLabel.textColor = MaterialColor.white titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.regularWithSize(20) titleLabel.font = RobotoFont.regularWithSize(17)
navigationBarView.titleLabel = titleLabel navigationBarView.titleLabel = titleLabel
navigationBarView.titleLabelInset.left = 64
// Detail label. // Detail label.
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.text = "Build Beautiful Software" detailLabel.text = "Build Beautiful Software"
...@@ -79,12 +70,11 @@ class ViewController: UIViewController { ...@@ -79,12 +70,11 @@ class ViewController: UIViewController {
detailLabel.textColor = MaterialColor.white detailLabel.textColor = MaterialColor.white
detailLabel.font = RobotoFont.regularWithSize(12) detailLabel.font = RobotoFont.regularWithSize(12)
navigationBarView.detailLabel = detailLabel navigationBarView.detailLabel = detailLabel
navigationBarView.detailLabelInset.left = 64
// Menu button. // Menu button.
let img1: UIImage? = UIImage(named: "ic_menu_white") let img1: UIImage? = UIImage(named: "ic_menu_white")
let btn1: FlatButton = FlatButton() let btn1: FlatButton = FlatButton()
btn1.pulseColor = MaterialColor.white btn1.pulseColor = nil
btn1.pulseScale = false btn1.pulseScale = false
btn1.setImage(img1, forState: .Normal) btn1.setImage(img1, forState: .Normal)
btn1.setImage(img1, forState: .Highlighted) btn1.setImage(img1, forState: .Highlighted)
...@@ -92,7 +82,7 @@ class ViewController: UIViewController { ...@@ -92,7 +82,7 @@ class ViewController: UIViewController {
// Star button. // Star button.
let img2: UIImage? = UIImage(named: "ic_star_white") let img2: UIImage? = UIImage(named: "ic_star_white")
let btn2: FlatButton = FlatButton() let btn2: FlatButton = FlatButton()
btn2.pulseColor = MaterialColor.white btn2.pulseColor = nil
btn2.pulseScale = false btn2.pulseScale = false
btn2.setImage(img2, forState: .Normal) btn2.setImage(img2, forState: .Normal)
btn2.setImage(img2, forState: .Highlighted) btn2.setImage(img2, forState: .Highlighted)
...@@ -100,18 +90,16 @@ class ViewController: UIViewController { ...@@ -100,18 +90,16 @@ class ViewController: UIViewController {
// Search button. // Search button.
let img3: UIImage? = UIImage(named: "ic_search_white") let img3: UIImage? = UIImage(named: "ic_search_white")
let btn3: FlatButton = FlatButton() let btn3: FlatButton = FlatButton()
btn3.pulseColor = MaterialColor.white btn3.pulseColor = nil
btn3.pulseScale = false btn3.pulseScale = false
btn3.setImage(img3, forState: .Normal) btn3.setImage(img3, forState: .Normal)
btn3.setImage(img3, forState: .Highlighted) btn3.setImage(img3, forState: .Highlighted)
// Add buttons to left side. // Add buttons to left side.
navigationBarView.leftButtons = [btn1] navigationBarView.leftControls = [btn1]
// Add buttons to right side. // Add buttons to right side.
navigationBarView.rightButtons = [btn2, btn3] navigationBarView.rightControls = [btn2, btn3]
MaterialLayout.height(view, child: navigationBarView, height: 70)
} }
} }
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
96A71EC71C6FFF0500C0C4AE /* MaterialSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EC61C6FFF0500C0C4AE /* MaterialSwitch.swift */; }; 96A71EC71C6FFF0500C0C4AE /* MaterialSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EC61C6FFF0500C0C4AE /* MaterialSwitch.swift */; };
96A71EF61C71127100C0C4AE /* SearchBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EF51C71127100C0C4AE /* SearchBarView.swift */; }; 96A71EF61C71127100C0C4AE /* SearchBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EF51C71127100C0C4AE /* SearchBarView.swift */; };
96A71F301C72E41100C0C4AE /* NavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F2F1C72E41100C0C4AE /* NavigationViewController.swift */; }; 96A71F301C72E41100C0C4AE /* NavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F2F1C72E41100C0C4AE /* NavigationViewController.swift */; };
96A71F351C7395C200C0C4AE /* MaterialCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F341C7395C200C0C4AE /* MaterialCollectionViewCell.swift */; };
96A71F371C73967E00C0C4AE /* MaterialPulseCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F361C73967E00C0C4AE /* MaterialPulseCollectionViewCell.swift */; };
96A71F451C74ABCB00C0C4AE /* MaterialBorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F441C74ABCB00C0C4AE /* MaterialBorder.swift */; }; 96A71F451C74ABCB00C0C4AE /* MaterialBorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F441C74ABCB00C0C4AE /* MaterialBorder.swift */; };
96D88C1E1C1328D800B91418 /* CaptureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF51C1328D800B91418 /* CaptureView.swift */; }; 96D88C1E1C1328D800B91418 /* CaptureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF51C1328D800B91418 /* CaptureView.swift */; };
96D88C1F1C1328D800B91418 /* CardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF61C1328D800B91418 /* CardView.swift */; }; 96D88C1F1C1328D800B91418 /* CardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88BF61C1328D800B91418 /* CardView.swift */; };
...@@ -146,8 +144,6 @@ ...@@ -146,8 +144,6 @@
96A71EC61C6FFF0500C0C4AE /* MaterialSwitch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialSwitch.swift; sourceTree = "<group>"; }; 96A71EC61C6FFF0500C0C4AE /* MaterialSwitch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialSwitch.swift; sourceTree = "<group>"; };
96A71EF51C71127100C0C4AE /* SearchBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarView.swift; sourceTree = "<group>"; }; 96A71EF51C71127100C0C4AE /* SearchBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarView.swift; sourceTree = "<group>"; };
96A71F2F1C72E41100C0C4AE /* NavigationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationViewController.swift; sourceTree = "<group>"; }; 96A71F2F1C72E41100C0C4AE /* NavigationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationViewController.swift; sourceTree = "<group>"; };
96A71F341C7395C200C0C4AE /* MaterialCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCollectionViewCell.swift; sourceTree = "<group>"; };
96A71F361C73967E00C0C4AE /* MaterialPulseCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseCollectionViewCell.swift; sourceTree = "<group>"; };
96A71F441C74ABCB00C0C4AE /* MaterialBorder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialBorder.swift; sourceTree = "<group>"; }; 96A71F441C74ABCB00C0C4AE /* MaterialBorder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialBorder.swift; sourceTree = "<group>"; };
96D88BF51C1328D800B91418 /* CaptureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureView.swift; sourceTree = "<group>"; }; 96D88BF51C1328D800B91418 /* CaptureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureView.swift; sourceTree = "<group>"; };
96D88BF61C1328D800B91418 /* CardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardView.swift; sourceTree = "<group>"; }; 96D88BF61C1328D800B91418 /* CardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardView.swift; sourceTree = "<group>"; };
...@@ -287,15 +283,6 @@ ...@@ -287,15 +283,6 @@
name = Search; name = Search;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
96A71F331C73959100C0C4AE /* CollectionView */ = {
isa = PBXGroup;
children = (
96A71F361C73967E00C0C4AE /* MaterialPulseCollectionViewCell.swift */,
96A71F341C7395C200C0C4AE /* MaterialCollectionViewCell.swift */,
);
name = CollectionView;
sourceTree = "<group>";
};
96D88BF41C1328D800B91418 /* Sources */ = { 96D88BF41C1328D800B91418 /* Sources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -317,7 +304,6 @@ ...@@ -317,7 +304,6 @@
96D88C471C1328F500B91418 /* Font */, 96D88C471C1328F500B91418 /* Font */,
966F57B61C226D65009185B7 /* Text */, 966F57B61C226D65009185B7 /* Text */,
96442ADC1C28EF1400C3C574 /* TableView */, 96442ADC1C28EF1400C3C574 /* TableView */,
96A71F331C73959100C0C4AE /* CollectionView */,
965C58BD1C6B8D3300CFB4E1 /* Grid */, 965C58BD1C6B8D3300CFB4E1 /* Grid */,
96A71E921C6FBC2900C0C4AE /* Menu */, 96A71E921C6FBC2900C0C4AE /* Menu */,
96A71EC51C6FFEF300C0C4AE /* Switch */, 96A71EC51C6FFEF300C0C4AE /* Switch */,
...@@ -641,7 +627,6 @@ ...@@ -641,7 +627,6 @@
96D88C2B1C1328D800B91418 /* MaterialButton.swift in Sources */, 96D88C2B1C1328D800B91418 /* MaterialButton.swift in Sources */,
96D88C311C1328D800B91418 /* MaterialKeyframeAnimation.swift in Sources */, 96D88C311C1328D800B91418 /* MaterialKeyframeAnimation.swift in Sources */,
96D88C2E1C1328D800B91418 /* MaterialFont.swift in Sources */, 96D88C2E1C1328D800B91418 /* MaterialFont.swift in Sources */,
96A71F371C73967E00C0C4AE /* MaterialPulseCollectionViewCell.swift in Sources */,
9656CD0C1C6BD33700EBCEF1 /* Grid.swift in Sources */, 9656CD0C1C6BD33700EBCEF1 /* Grid.swift in Sources */,
960B23461C38480E00E96216 /* Text.swift in Sources */, 960B23461C38480E00E96216 /* Text.swift in Sources */,
96D88C351C1328D800B91418 /* MaterialLayout.swift in Sources */, 96D88C351C1328D800B91418 /* MaterialLayout.swift in Sources */,
...@@ -680,7 +665,6 @@ ...@@ -680,7 +665,6 @@
960B23331C383EAA00E96216 /* Material+UIImage+Size.swift in Sources */, 960B23331C383EAA00E96216 /* Material+UIImage+Size.swift in Sources */,
96A71F451C74ABCB00C0C4AE /* MaterialBorder.swift in Sources */, 96A71F451C74ABCB00C0C4AE /* MaterialBorder.swift in Sources */,
96A71E911C6FBC2200C0C4AE /* MenuView.swift in Sources */, 96A71E911C6FBC2200C0C4AE /* MenuView.swift in Sources */,
96A71F351C7395C200C0C4AE /* MaterialCollectionViewCell.swift in Sources */,
96D88C271C1328D800B91418 /* Material+UIFont.swift in Sources */, 96D88C271C1328D800B91418 /* Material+UIFont.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
......
...@@ -169,7 +169,13 @@ public class NavigationBarView : MaterialView { ...@@ -169,7 +169,13 @@ public class NavigationBarView : MaterialView {
} }
public override func intrinsicContentSize() -> CGSize { public override func intrinsicContentSize() -> CGSize {
return CGSizeMake(UIScreen.mainScreen().bounds.width, 64) // General alignment.
switch UIDevice.currentDevice().orientation {
case .LandscapeLeft, .LandscapeRight:
return CGSizeMake(UIScreen.mainScreen().bounds.width, 44)
default:
return CGSizeMake(UIScreen.mainScreen().bounds.width, 64)
}
} }
/// Reloads the view. /// Reloads the view.
......
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