Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
83bb987b
Commit
83bb987b
authored
Mar 02, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added MaterialDevice as a helper class to determine device types
parent
6872b35d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
25 deletions
+95
-25
Examples/Programmatic/App/App.xcodeproj/project.pbxproj
+6
-0
Examples/Programmatic/NavigationBarView/NavigationBarView.xcodeproj/project.pbxproj
+6
-0
Material.xcodeproj/project.pbxproj
+4
-0
Sources/MaterialDevice.swift
+60
-0
Sources/NavigationBarViewController.swift
+0
-21
Sources/StatusBarView.swift
+5
-4
Sources/StatusBarViewController.swift
+14
-0
No files found.
Examples/Programmatic/App/App.xcodeproj/project.pbxproj
View file @
83bb987b
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
objects
=
{
objects
=
{
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
9656263C1C873E7C004ADEF7
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9656263B1C873E7C004ADEF7
/* Material.framework */
;
};
9656263D1C873E7C004ADEF7
/* Material.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9656263B1C873E7C004ADEF7
/* Material.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
9663F9321C7A744600AF0965
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9311C7A744600AF0965
/* AppDelegate.swift */
;
};
9663F9321C7A744600AF0965
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9311C7A744600AF0965
/* AppDelegate.swift */
;
};
9663F9341C7A744600AF0965
/* SearchListViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9331C7A744600AF0965
/* SearchListViewController.swift */
;
};
9663F9341C7A744600AF0965
/* SearchListViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9331C7A744600AF0965
/* SearchListViewController.swift */
;
};
9663F9391C7A744600AF0965
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9381C7A744600AF0965
/* Assets.xcassets */
;
};
9663F9391C7A744600AF0965
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9381C7A744600AF0965
/* Assets.xcassets */
;
};
...
@@ -27,6 +29,7 @@
...
@@ -27,6 +29,7 @@
dstPath
=
""
;
dstPath
=
""
;
dstSubfolderSpec
=
10
;
dstSubfolderSpec
=
10
;
files
=
(
files
=
(
9656263D1C873E7C004ADEF7
/* Material.framework in Embed Frameworks */
,
);
);
name
=
"Embed Frameworks"
;
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
...
@@ -34,6 +37,7 @@
...
@@ -34,6 +37,7 @@
/* End PBXCopyFilesBuildPhase section */
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
9656263B1C873E7C004ADEF7
/* 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>"
;
};
9663F92E1C7A744600AF0965
/* App.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
App.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
9663F92E1C7A744600AF0965
/* App.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
App.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
9663F9311C7A744600AF0965
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
9663F9311C7A744600AF0965
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
9663F9331C7A744600AF0965
/* SearchListViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SearchListViewController.swift
;
sourceTree
=
"<group>"
;
};
9663F9331C7A744600AF0965
/* SearchListViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SearchListViewController.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -54,6 +58,7 @@
...
@@ -54,6 +58,7 @@
isa
=
PBXFrameworksBuildPhase
;
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
buildActionMask
=
2147483647
;
files
=
(
files
=
(
9656263C1C873E7C004ADEF7
/* Material.framework in Frameworks */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
@@ -63,6 +68,7 @@
...
@@ -63,6 +68,7 @@
9663F9251C7A744500AF0965
=
{
9663F9251C7A744500AF0965
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
9656263B1C873E7C004ADEF7
/* Material.framework */
,
9663F9301C7A744600AF0965
/* App */
,
9663F9301C7A744600AF0965
/* App */
,
9663F92F1C7A744600AF0965
/* Products */
,
9663F92F1C7A744600AF0965
/* Products */
,
);
);
...
...
Examples/Programmatic/NavigationBarView/NavigationBarView.xcodeproj/project.pbxproj
View file @
83bb987b
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
objects
=
{
objects
=
{
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
9656263F1C87443D004ADEF7
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9656263E1C87443D004ADEF7
/* Material.framework */
;
};
965626401C87443D004ADEF7
/* Material.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9656263E1C87443D004ADEF7
/* Material.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
96D88C831C132C1800B91418
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C821C132C1800B91418
/* AppDelegate.swift */
;
};
96D88C831C132C1800B91418
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C821C132C1800B91418
/* AppDelegate.swift */
;
};
96D88C851C132C1800B91418
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C841C132C1800B91418
/* ViewController.swift */
;
};
96D88C851C132C1800B91418
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C841C132C1800B91418
/* ViewController.swift */
;
};
96D88C8A1C132C1800B91418
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C891C132C1800B91418
/* Assets.xcassets */
;
};
96D88C8A1C132C1800B91418
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D88C891C132C1800B91418
/* Assets.xcassets */
;
};
...
@@ -20,6 +22,7 @@
...
@@ -20,6 +22,7 @@
dstPath
=
""
;
dstPath
=
""
;
dstSubfolderSpec
=
10
;
dstSubfolderSpec
=
10
;
files
=
(
files
=
(
965626401C87443D004ADEF7
/* Material.framework in Embed Frameworks */
,
);
);
name
=
"Embed Frameworks"
;
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
...
@@ -27,6 +30,7 @@
...
@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
9656263E1C87443D004ADEF7
/* 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>"
;
};
96D88C7F1C132C1800B91418
/* NavigationBarView.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
NavigationBarView.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
96D88C7F1C132C1800B91418
/* NavigationBarView.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
NavigationBarView.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
96D88C821C132C1800B91418
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
96D88C821C132C1800B91418
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
96D88C841C132C1800B91418
/* ViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ViewController.swift
;
sourceTree
=
"<group>"
;
};
96D88C841C132C1800B91418
/* ViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ViewController.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -40,6 +44,7 @@
...
@@ -40,6 +44,7 @@
isa
=
PBXFrameworksBuildPhase
;
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
buildActionMask
=
2147483647
;
files
=
(
files
=
(
9656263F1C87443D004ADEF7
/* Material.framework in Frameworks */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
@@ -49,6 +54,7 @@
...
@@ -49,6 +54,7 @@
96D88C761C132C1800B91418
=
{
96D88C761C132C1800B91418
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
9656263E1C87443D004ADEF7
/* Material.framework */
,
96D88C811C132C1800B91418
/* NavigationBarView */
,
96D88C811C132C1800B91418
/* NavigationBarView */
,
96D88C801C132C1800B91418
/* Products */
,
96D88C801C132C1800B91418
/* Products */
,
);
);
...
...
Material.xcodeproj/project.pbxproj
View file @
83bb987b
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
96442ADB1C28EEFA00C3C574
/* TextField.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966F57B71C226D75009185B7
/* TextField.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96442ADB1C28EEFA00C3C574
/* TextField.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966F57B71C226D75009185B7
/* TextField.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96442ADE1C28EF3700C3C574
/* MaterialTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96442ADD1C28EF3700C3C574
/* MaterialTableViewCell.swift */
;
};
96442ADE1C28EF3700C3C574
/* MaterialTableViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96442ADD1C28EF3700C3C574
/* MaterialTableViewCell.swift */
;
};
96442ADF1C28EF3E00C3C574
/* MaterialTableViewCell.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96442ADD1C28EF3700C3C574
/* MaterialTableViewCell.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96442ADF1C28EF3E00C3C574
/* MaterialTableViewCell.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96442ADD1C28EF3700C3C574
/* MaterialTableViewCell.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
965626421C874FAE004ADEF7
/* MaterialDevice.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965626411C874FAE004ADEF7
/* MaterialDevice.swift */
;
};
9656CD0C1C6BD33700EBCEF1
/* Grid.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9656CD0B1C6BD33700EBCEF1
/* Grid.swift */
;
};
9656CD0C1C6BD33700EBCEF1
/* Grid.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9656CD0B1C6BD33700EBCEF1
/* Grid.swift */
;
};
966F57B81C226D75009185B7
/* TextField.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966F57B71C226D75009185B7
/* TextField.swift */
;
};
966F57B81C226D75009185B7
/* TextField.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
966F57B71C226D75009185B7
/* TextField.swift */
;
};
96A71E911C6FBC2200C0C4AE
/* MenuView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96A71E901C6FBC2200C0C4AE
/* MenuView.swift */
;
};
96A71E911C6FBC2200C0C4AE
/* MenuView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96A71E901C6FBC2200C0C4AE
/* MenuView.swift */
;
};
...
@@ -161,6 +162,7 @@
...
@@ -161,6 +162,7 @@
963832411B88DFD80015F710
/* Material.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
Material.xctest
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
963832411B88DFD80015F710
/* Material.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
Material.xctest
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
963832591B88E31A0015F710
/* Info.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
963832591B88E31A0015F710
/* Info.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
96442ADD1C28EF3700C3C574
/* MaterialTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
96442ADD1C28EF3700C3C574
/* MaterialTableViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTableViewCell.swift
;
sourceTree
=
"<group>"
;
};
965626411C874FAE004ADEF7
/* MaterialDevice.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialDevice.swift
;
sourceTree
=
"<group>"
;
};
9656CD0B1C6BD33700EBCEF1
/* Grid.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Grid.swift
;
sourceTree
=
"<group>"
;
};
9656CD0B1C6BD33700EBCEF1
/* Grid.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Grid.swift
;
sourceTree
=
"<group>"
;
};
966F57B71C226D75009185B7
/* TextField.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TextField.swift
;
sourceTree
=
"<group>"
;
};
966F57B71C226D75009185B7
/* TextField.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TextField.swift
;
sourceTree
=
"<group>"
;
};
96A71E901C6FBC2200C0C4AE
/* MenuView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MenuView.swift
;
sourceTree
=
"<group>"
;
};
96A71E901C6FBC2200C0C4AE
/* MenuView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MenuView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -431,6 +433,7 @@
...
@@ -431,6 +433,7 @@
96D88C071C1328D800B91418
/* MaterialEdgeInset.swift */
,
96D88C071C1328D800B91418
/* MaterialEdgeInset.swift */
,
96A71F441C74ABCB00C0C4AE
/* MaterialBorder.swift */
,
96A71F441C74ABCB00C0C4AE
/* MaterialBorder.swift */
,
96CC089F1C80CB180034FF84
/* MaterialSpacing.swift */
,
96CC089F1C80CB180034FF84
/* MaterialSpacing.swift */
,
965626411C874FAE004ADEF7
/* MaterialDevice.swift */
,
);
);
name
=
Type
;
name
=
Type
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -755,6 +758,7 @@
...
@@ -755,6 +758,7 @@
960B23271C383E5500E96216
/* Material+String.swift in Sources */
,
960B23271C383E5500E96216
/* Material+String.swift in Sources */
,
96CC083D1C7CF9D40034FF84
/* StatusBarViewController.swift in Sources */
,
96CC083D1C7CF9D40034FF84
/* StatusBarViewController.swift in Sources */
,
960B23471C38480E00E96216
/* TextStorage.swift in Sources */
,
960B23471C38480E00E96216
/* TextStorage.swift in Sources */
,
965626421C874FAE004ADEF7
/* MaterialDevice.swift in Sources */
,
96D88C341C1328D800B91418
/* MaterialLayer.swift in Sources */
,
96D88C341C1328D800B91418
/* MaterialLayer.swift in Sources */
,
96D88C461C1328D800B91418
/* SideNavigationViewController.swift in Sources */
,
96D88C461C1328D800B91418
/* SideNavigationViewController.swift in Sources */
,
96D88C381C1328D800B91418
/* MaterialShape.swift in Sources */
,
96D88C381C1328D800B91418
/* MaterialShape.swift in Sources */
,
...
...
Sources/MaterialDevice.swift
0 → 100644
View file @
83bb987b
/*
* 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
public
enum
MaterialDeviceType
{
case
iPad
case
iPhone
case
TV
case
Unspecified
}
public
struct
MaterialDevice
{
/// Retrieves the current device type.
public
static
var
type
:
MaterialDeviceType
{
switch
UIDevice
.
currentDevice
()
.
userInterfaceIdiom
{
case
.
Pad
:
return
.
iPad
case
.
Phone
:
return
.
iPhone
case
.
TV
:
return
.
TV
case
.
Unspecified
:
return
.
Unspecified
}
}
/// A Boolean indicating if the device is in Landscape mode.
public
static
var
landscape
:
Bool
{
return
UIApplication
.
sharedApplication
()
.
statusBarOrientation
.
isLandscape
}
}
\ No newline at end of file
Sources/NavigationBarViewController.swift
View file @
83bb987b
...
@@ -130,11 +130,6 @@ public class NavigationBarViewController: StatusBarViewController {
...
@@ -130,11 +130,6 @@ public class NavigationBarViewController: StatusBarViewController {
}
}
}
}
public
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
layoutSubviews
()
}
/**
/**
Prepares the view instance when intialized. When subclassing,
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
it is recommended to override the prepareView method
...
@@ -149,22 +144,7 @@ public class NavigationBarViewController: StatusBarViewController {
...
@@ -149,22 +144,7 @@ public class NavigationBarViewController: StatusBarViewController {
/// Prepares the NavigationBarView.
/// Prepares the NavigationBarView.
private
func
prepareNavigationBarView
()
{
private
func
prepareNavigationBarView
()
{
navigationBarView
.
delegate
=
self
navigationBarView
.
zPosition
=
1000
navigationBarView
.
zPosition
=
1000
view
.
addSubview
(
navigationBarView
)
view
.
addSubview
(
navigationBarView
)
}
}
/// Layout subviews.
private
func
layoutSubviews
()
{
let
size
:
CGSize
=
UIScreen
.
mainScreen
()
.
bounds
.
size
let
h
:
CGFloat
=
UIApplication
.
sharedApplication
()
.
statusBarFrame
.
size
.
height
mainViewController
.
view
.
frame
=
CGRectMake
(
0
,
navigationBarView
.
height
,
size
.
width
,
size
.
height
-
navigationBarView
.
height
-
(
20
>=
h
?
0
:
h
-
20
))
}
}
}
extension
NavigationBarViewController
:
NavigationBarViewDelegate
{
/// Monitor layout changes.
public
func
navigationBarViewDidChangeLayout
(
navigationBarView
:
NavigationBarView
)
{
layoutSubviews
()
}
}
\ No newline at end of file
Sources/StatusBarView.swift
View file @
83bb987b
...
@@ -58,12 +58,12 @@ public class StatusBarView : ControlView {
...
@@ -58,12 +58,12 @@ public class StatusBarView : ControlView {
public
override
func
layoutSubviews
()
{
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
width
=
UIScreen
.
mainScreen
()
.
bounds
.
width
grid
.
axis
.
columns
=
Int
(
width
/
48
)
grid
.
axis
.
columns
=
Int
(
width
/
48
)
print
(
UIDevice
.
currentDevice
()
.
userInterfaceIdiom
)
// General alignment.
// General alignment.
if
UIApplication
.
sharedApplication
()
.
statusBarOrientation
.
isL
andscape
{
if
.
iPhone
==
MaterialDevice
.
type
&&
MaterialDevice
.
l
andscape
{
grid
.
contentInset
.
top
=
8
grid
.
contentInset
.
top
=
8
height
=
44
height
=
44
}
else
{
}
else
{
...
@@ -74,10 +74,10 @@ public class StatusBarView : ControlView {
...
@@ -74,10 +74,10 @@ public class StatusBarView : ControlView {
reloadView
()
reloadView
()
if
frame
.
origin
.
x
!=
oldFrame
!.
origin
.
x
||
frame
.
origin
.
y
!=
oldFrame
!.
origin
.
y
||
frame
.
width
!=
oldFrame
!.
width
||
frame
.
height
!=
oldFrame
!.
height
{
if
frame
.
origin
.
x
!=
oldFrame
!.
origin
.
x
||
frame
.
origin
.
y
!=
oldFrame
!.
origin
.
y
||
frame
.
width
!=
oldFrame
!.
width
||
frame
.
height
!=
oldFrame
!.
height
{
oldFrame
=
frame
if
nil
!=
delegate
{
if
nil
!=
delegate
{
statusBarViewDidChangeLayout
()
statusBarViewDidChangeLayout
()
}
}
oldFrame
=
frame
}
}
}
}
...
@@ -102,6 +102,7 @@ public class StatusBarView : ControlView {
...
@@ -102,6 +102,7 @@ public class StatusBarView : ControlView {
oldFrame
=
frame
oldFrame
=
frame
grid
.
spacingPreset
=
.
Spacing2
grid
.
spacingPreset
=
.
Spacing2
grid
.
contentInsetPreset
=
.
Square2
grid
.
contentInsetPreset
=
.
Square2
autoresizingMask
=
.
FlexibleWidth
}
}
/// Chaining method for subclasses to offer delegation or other useful features.
/// Chaining method for subclasses to offer delegation or other useful features.
...
...
Sources/StatusBarViewController.swift
View file @
83bb987b
...
@@ -107,6 +107,20 @@ public class StatusBarViewController: UIViewController {
...
@@ -107,6 +107,20 @@ public class StatusBarViewController: UIViewController {
prepareMainViewController
()
prepareMainViewController
()
}
}
public
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
layoutSubviews
()
}
/// Layout subviews.
private
func
layoutSubviews
()
{
let
size
:
CGSize
=
UIScreen
.
mainScreen
()
.
bounds
.
size
let
h
:
CGFloat
=
UIApplication
.
sharedApplication
()
.
statusBarFrame
.
size
.
height
print
(
size
)
// mainViewController.view.frame = CGRectMake(0, navigationBarView.height, size.width, size.height - navigationBarView.height - (20 >= h ? 0 : h - 20))
}
/// A method that prepares the mainViewController.
/// A method that prepares the mainViewController.
private
func
prepareMainViewController
()
{
private
func
prepareMainViewController
()
{
prepareViewControllerWithinContainer
(
mainViewController
,
container
:
view
)
prepareViewControllerWithinContainer
(
mainViewController
,
container
:
view
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment