Commit c524d017 by danieldahan

additional examples added to Grid

parent 712f0979
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
965C58CF1C6B936400CFB4E1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965C58CE1C6B936400CFB4E1 /* ViewController.swift */; }; 965C58CF1C6B936400CFB4E1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965C58CE1C6B936400CFB4E1 /* ViewController.swift */; };
965C58D41C6B936400CFB4E1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 965C58D31C6B936400CFB4E1 /* Assets.xcassets */; }; 965C58D41C6B936400CFB4E1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 965C58D31C6B936400CFB4E1 /* Assets.xcassets */; };
965C58D71C6B936400CFB4E1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 965C58D51C6B936400CFB4E1 /* LaunchScreen.storyboard */; }; 965C58D71C6B936400CFB4E1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 965C58D51C6B936400CFB4E1 /* LaunchScreen.storyboard */; };
965C58DF1C6B949A00CFB4E1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 965C58DE1C6B949A00CFB4E1 /* Material.framework */; };
965C58E01C6B949A00CFB4E1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 965C58DE1C6B949A00CFB4E1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -22,7 +20,6 @@ ...@@ -22,7 +20,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
965C58E01C6B949A00CFB4E1 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -36,7 +33,6 @@ ...@@ -36,7 +33,6 @@
965C58D31C6B936400CFB4E1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 965C58D31C6B936400CFB4E1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
965C58D61C6B936400CFB4E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 965C58D61C6B936400CFB4E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
965C58D81C6B936400CFB4E1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 965C58D81C6B936400CFB4E1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
965C58DE1C6B949A00CFB4E1 /* 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>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -44,7 +40,6 @@ ...@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
965C58DF1C6B949A00CFB4E1 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
965C58C01C6B936400CFB4E1 = { 965C58C01C6B936400CFB4E1 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
965C58DE1C6B949A00CFB4E1 /* Material.framework */,
965C58CB1C6B936400CFB4E1 /* GridView */, 965C58CB1C6B936400CFB4E1 /* GridView */,
965C58CA1C6B936400CFB4E1 /* Products */, 965C58CA1C6B936400CFB4E1 /* Products */,
); );
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
<array> <array>
<string>armv7</string> <string>armv7</string>
</array> </array>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
......
...@@ -42,7 +42,9 @@ class ViewController: UIViewController { ...@@ -42,7 +42,9 @@ class ViewController: UIViewController {
prepareView() prepareView()
// prepareHorizontalGridViewExample() // prepareHorizontalGridViewExample()
// prepareVerticalGridViewExample() // prepareVerticalGridViewExample()
prepareSmallCardViewExample() // prepareSmallCardViewExample()
// prepareMediumCardViewExample()
prepareLargeCardViewExample()
} }
...@@ -51,9 +53,207 @@ class ViewController: UIViewController { ...@@ -51,9 +53,207 @@ class ViewController: UIViewController {
view.backgroundColor = MaterialColor.white view.backgroundColor = MaterialColor.white
} }
/// Prepares the medium card example.
private func prepareLargeCardViewExample() {
let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 350))
cardView.pulseColor = MaterialColor.blueGrey.lighten5
cardView.grid.axis = .Vertical
cardView.depth = .Depth1
view.addSubview(cardView)
let imageView: MaterialView = MaterialView()
imageView.grid.row = .Row7
imageView.grid.column = .Column6
imageView.grid.spacing = 4
cardView.addSubview(imageView)
var image: UIImage? = UIImage(named: "CosmicMindInverted")
let leftImageViewCollection: MaterialView = MaterialView()
leftImageViewCollection.grid.column = .Column3
leftImageViewCollection.image = image
leftImageViewCollection.contentsGravity = .ResizeAspectFill
imageView.addSubview(leftImageViewCollection)
let rightImageViewCollection: MaterialView = MaterialView()
rightImageViewCollection.grid.column = .Column3
rightImageViewCollection.grid.axis = .Vertical
rightImageViewCollection.grid.spacing = 4
imageView.addSubview(rightImageViewCollection)
image = UIImage(named: "CosmicMindInverted")
let topImageViewCollection: MaterialView = MaterialView()
topImageViewCollection.grid.row = .Row6
topImageViewCollection.image = image
topImageViewCollection.contentsGravity = .ResizeAspectFill
rightImageViewCollection.addSubview(topImageViewCollection)
image = UIImage(named: "CosmicMindInverted")
let bottomImageViewCollection: MaterialView = MaterialView()
bottomImageViewCollection.grid.row = .Row6
bottomImageViewCollection.image = image
bottomImageViewCollection.contentsGravity = .ResizeAspectFill
rightImageViewCollection.addSubview(bottomImageViewCollection)
let contentView: MaterialView = MaterialView()
contentView.grid.row = .Row5
contentView.grid.axis = .Vertical
contentView.grid.contentInsetPreset = .Square3
contentView.backgroundColor = MaterialColor.clear
cardView.addSubview(contentView)
let titleView: MaterialView = MaterialView()
titleView.grid.row = .Row1
titleView.backgroundColor = MaterialColor.clear
contentView.addSubview(titleView)
let titleLabel: UILabel = UILabel()
titleLabel.grid.column = .Column7
titleLabel.text = "Material"
titleLabel.textColor = MaterialColor.blueGrey.darken4
titleLabel.backgroundColor = MaterialColor.clear
titleView.addSubview(titleLabel)
image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate)
let moreButton: FlatButton = FlatButton()
moreButton.grid.column = .Column1
moreButton.grid.columnOffset = .Column4
moreButton.contentInsetPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
moreButton.tintColor = MaterialColor.blueGrey.darken4
moreButton.setImage(image, forState: .Normal)
moreButton.setImage(image, forState: .Highlighted)
titleView.addSubview(moreButton)
let detailLabel: UILabel = UILabel()
detailLabel.grid.row = .Row3
detailLabel.numberOfLines = 0
detailLabel.lineBreakMode = .ByTruncatingTail
detailLabel.font = RobotoFont.regularWithSize(12)
detailLabel.text = "Material is a graphics and animation framework for Google's Material Design. It is designed to allow the creativity of others to easily be expressed."
detailLabel.textColor = MaterialColor.blueGrey.darken4
detailLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(detailLabel)
let alarmView: MaterialView = MaterialView()
alarmView.grid.row = .Row1
alarmView.backgroundColor = MaterialColor.clear
contentView.addSubview(alarmView)
let alarmLabel: UILabel = UILabel()
alarmLabel.grid.column = .Column7
alarmLabel.font = RobotoFont.regularWithSize(12)
alarmLabel.text = "34 min"
alarmLabel.textColor = MaterialColor.blueGrey.darken4
alarmLabel.backgroundColor = MaterialColor.clear
alarmView.addSubview(alarmLabel)
image = UIImage(named: "ic_alarm_white")?.imageWithRenderingMode(.AlwaysTemplate)
let alarmButton: FlatButton = FlatButton()
alarmButton.grid.column = .Column1
alarmButton.grid.columnOffset = .Column4
alarmButton.contentInsetPreset = .None
alarmButton.pulseColor = MaterialColor.blueGrey.darken4
alarmButton.tintColor = MaterialColor.red.base
alarmButton.setImage(image, forState: .Normal)
alarmButton.setImage(image, forState: .Highlighted)
alarmView.addSubview(alarmButton)
cardView.grid.views = [imageView, contentView]
imageView.grid.views = [leftImageViewCollection, rightImageViewCollection]
rightImageViewCollection.grid.views = [topImageViewCollection, bottomImageViewCollection]
contentView.grid.views = [titleView, detailLabel, alarmView]
titleView.grid.views = [titleLabel, moreButton]
alarmView.grid.views = [alarmLabel, alarmButton]
}
/// Prepares the medium card example.
private func prepareMediumCardViewExample() {
let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 240))
cardView.pulseColor = MaterialColor.blueGrey.lighten5
cardView.depth = .Depth1
view.addSubview(cardView)
var image: UIImage? = UIImage(named: "CosmicMindInverted")
let imageView: MaterialView = MaterialView()
imageView.grid.column = .Column6
imageView.image = image
imageView.contentsGravity = .ResizeAspectFill
cardView.addSubview(imageView)
let contentView: MaterialView = MaterialView()
contentView.grid.column = .Column6
contentView.grid.axis = .Vertical
contentView.grid.contentInsetPreset = .Square3
contentView.grid.spacing = 8
contentView.backgroundColor = MaterialColor.clear
cardView.addSubview(contentView)
let titleView: MaterialView = MaterialView()
titleView.grid.column = .Column6
titleView.grid.row = .Row2
titleView.backgroundColor = MaterialColor.clear
contentView.addSubview(titleView)
let titleLabel: UILabel = UILabel()
titleLabel.grid.column = .Column5
titleLabel.text = "Material"
titleLabel.textColor = MaterialColor.blueGrey.darken4
titleLabel.backgroundColor = MaterialColor.clear
titleView.addSubview(titleLabel)
image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate)
let moreButton: FlatButton = FlatButton()
moreButton.grid.column = .Column1
moreButton.contentInsetPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
moreButton.tintColor = MaterialColor.blueGrey.darken4
moreButton.setImage(image, forState: .Normal)
moreButton.setImage(image, forState: .Highlighted)
titleView.addSubview(moreButton)
let detailLabel: UILabel = UILabel()
detailLabel.grid.row = .Row8
detailLabel.numberOfLines = 0
detailLabel.lineBreakMode = .ByTruncatingTail
detailLabel.font = RobotoFont.regularWithSize(12)
detailLabel.text = "Material is a graphics and animation framework for Google's Material Design. It is designed to allow the creativity of others to easily be expressed."
detailLabel.textColor = MaterialColor.blueGrey.darken4
detailLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(detailLabel)
let alarmView: MaterialView = MaterialView()
alarmView.grid.column = .Column6
alarmView.grid.row = .Row2
alarmView.backgroundColor = MaterialColor.clear
contentView.addSubview(alarmView)
let alarmLabel: UILabel = UILabel()
alarmLabel.grid.column = .Column5
alarmLabel.font = RobotoFont.regularWithSize(12)
alarmLabel.text = "34 min"
alarmLabel.textColor = MaterialColor.blueGrey.darken4
alarmLabel.backgroundColor = MaterialColor.clear
alarmView.addSubview(alarmLabel)
image = UIImage(named: "ic_alarm_white")?.imageWithRenderingMode(.AlwaysTemplate)
let alarmButton: FlatButton = FlatButton()
alarmButton.grid.column = .Column1
alarmButton.contentInsetPreset = .None
alarmButton.pulseColor = MaterialColor.blueGrey.darken4
alarmButton.tintColor = MaterialColor.red.base
alarmButton.setImage(image, forState: .Normal)
alarmButton.setImage(image, forState: .Highlighted)
alarmView.addSubview(alarmButton)
cardView.grid.views = [imageView, contentView]
contentView.grid.views = [titleView, detailLabel, alarmView]
titleView.grid.views = [titleLabel, moreButton]
alarmView.grid.views = [alarmLabel, alarmButton]
}
/// Prepares the small card example. /// Prepares the small card example.
private func prepareSmallCardViewExample() { private func prepareSmallCardViewExample() {
let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 200)) let cardView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(16, 100, view.bounds.width - 32, 152))
cardView.pulseColor = MaterialColor.blueGrey.lighten5 cardView.pulseColor = MaterialColor.blueGrey.lighten5
cardView.depth = .Depth1 cardView.depth = .Depth1
view.addSubview(cardView) view.addSubview(cardView)
...@@ -69,13 +269,13 @@ class ViewController: UIViewController { ...@@ -69,13 +269,13 @@ class ViewController: UIViewController {
contentView.grid.column = .Column8 contentView.grid.column = .Column8
contentView.grid.axis = .Vertical contentView.grid.axis = .Vertical
contentView.grid.contentInsetPreset = .Square3 contentView.grid.contentInsetPreset = .Square3
contentView.grid.spacing = 16 contentView.grid.spacing = 12
contentView.backgroundColor = MaterialColor.clear contentView.backgroundColor = MaterialColor.clear
cardView.addSubview(contentView) cardView.addSubview(contentView)
let titleView: MaterialView = MaterialView() let titleView: MaterialView = MaterialView()
titleView.grid.column = .Column8 titleView.grid.column = .Column8
titleView.grid.row = .Row3 titleView.grid.row = .Row4
titleView.backgroundColor = MaterialColor.clear titleView.backgroundColor = MaterialColor.clear
contentView.addSubview(titleView) contentView.addSubview(titleView)
...@@ -97,7 +297,7 @@ class ViewController: UIViewController { ...@@ -97,7 +297,7 @@ class ViewController: UIViewController {
titleView.addSubview(moreButton) titleView.addSubview(moreButton)
let detailLabel: UILabel = UILabel() let detailLabel: UILabel = UILabel()
detailLabel.grid.row = .Row6 detailLabel.grid.row = .Row4
detailLabel.numberOfLines = 0 detailLabel.numberOfLines = 0
detailLabel.lineBreakMode = .ByTruncatingTail detailLabel.lineBreakMode = .ByTruncatingTail
detailLabel.font = RobotoFont.regularWithSize(12) detailLabel.font = RobotoFont.regularWithSize(12)
...@@ -105,10 +305,10 @@ class ViewController: UIViewController { ...@@ -105,10 +305,10 @@ class ViewController: UIViewController {
detailLabel.textColor = MaterialColor.blueGrey.darken4 detailLabel.textColor = MaterialColor.blueGrey.darken4
detailLabel.backgroundColor = MaterialColor.clear detailLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(detailLabel) contentView.addSubview(detailLabel)
let alarmView: MaterialView = MaterialView() let alarmView: MaterialView = MaterialView()
alarmView.grid.column = .Column8 alarmView.grid.column = .Column8
alarmView.grid.row = .Row3 alarmView.grid.row = .Row4
alarmView.backgroundColor = MaterialColor.clear alarmView.backgroundColor = MaterialColor.clear
contentView.addSubview(alarmView) contentView.addSubview(alarmView)
......
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