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
d5393fa0
Commit
d5393fa0
authored
Mar 26, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working Storyboard example for BottomNavigationBar
parent
cf752159
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
27 deletions
+50
-27
Examples/Storyboards/BottomNavigationBar/BottomNavigationBar.xcodeproj/project.pbxproj
+15
-0
Examples/Storyboards/BottomNavigationBar/BottomNavigationBar/Base.lproj/Main.storyboard
+6
-9
Examples/Storyboards/BottomNavigationBar/BottomNavigationBar/ViewController.swift
+11
-0
Sources/BottomNavigationBar.swift
+1
-1
Sources/MaterialColor.swift
+16
-16
Sources/NavigationBar.swift
+1
-1
No files found.
Examples/Storyboards/BottomNavigationBar/BottomNavigationBar.xcodeproj/project.pbxproj
View file @
d5393fa0
...
@@ -14,6 +14,19 @@
...
@@ -14,6 +14,19 @@
96162C171CA6F2BC00E3A235
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96162C151CA6F2BC00E3A235
/* LaunchScreen.storyboard */
;
};
96162C171CA6F2BC00E3A235
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96162C151CA6F2BC00E3A235
/* LaunchScreen.storyboard */
;
};
/* End PBXBuildFile section */
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
96162C211CA7037600E3A235
/* Embed Frameworks */
=
{
isa
=
PBXCopyFilesBuildPhase
;
buildActionMask
=
2147483647
;
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
96162C091CA6F2BC00E3A235
/* BottomNavigationBar.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
BottomNavigationBar.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
96162C091CA6F2BC00E3A235
/* BottomNavigationBar.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
BottomNavigationBar.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
96162C0C1CA6F2BC00E3A235
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
96162C0C1CA6F2BC00E3A235
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -74,6 +87,7 @@
...
@@ -74,6 +87,7 @@
96162C051CA6F2BC00E3A235
/* Sources */
,
96162C051CA6F2BC00E3A235
/* Sources */
,
96162C061CA6F2BC00E3A235
/* Frameworks */
,
96162C061CA6F2BC00E3A235
/* Frameworks */
,
96162C071CA6F2BC00E3A235
/* Resources */
,
96162C071CA6F2BC00E3A235
/* Resources */
,
96162C211CA7037600E3A235
/* Embed Frameworks */
,
);
);
buildRules
=
(
buildRules
=
(
);
);
...
@@ -286,6 +300,7 @@
...
@@ -286,6 +300,7 @@
96162C1D1CA6F2BC00E3A235
/* Release */
,
96162C1D1CA6F2BC00E3A235
/* Release */
,
);
);
defaultConfigurationIsVisible
=
0
;
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
};
};
/* End XCConfigurationList section */
/* End XCConfigurationList section */
};
};
...
...
Examples/Storyboards/BottomNavigationBar/BottomNavigationBar/Base.lproj/Main.storyboard
View file @
d5393fa0
...
@@ -17,31 +17,28 @@
...
@@ -17,31 +17,28 @@
<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>
<tabBar
contentMode=
"scaleToFill"
ambiguous=
"YES"
misplaced=
"YES"
translucent=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"sMP-AS-Zl9"
customClass=
"BottomNavigationBar"
customModule=
"Material"
>
<tabBar
contentMode=
"scaleToFill"
misplaced=
"YES"
translucent=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"sMP-AS-Zl9"
customClass=
"BottomNavigationBar"
customModule=
"Material"
>
<rect
key=
"frame"
x=
"0.0"
y=
"551"
width=
"600"
height=
"49"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"551"
width=
"600"
height=
"49"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"calibratedWhite"
/>
<constraints>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"56"
id=
"
k7G-L7-HGU
"
/>
<constraint
firstAttribute=
"height"
constant=
"56"
id=
"
2xR-RQ-MBH
"
/>
</constraints>
</constraints>
<items>
<items>
<tabBarItem
title=
"Video"
id=
"BkO-Yq-m1c"
customClass=
"BottomNavigationBarItem"
customModule=
"Material"
/>
<tabBarItem
title=
"Video"
id=
"BkO-Yq-m1c"
customClass=
"BottomNavigationBarItem"
customModule=
"Material"
/>
<tabBarItem
title=
"Photo"
id=
"vsG-AI-jYq"
customClass=
"BottomNavigationBarItem"
customModule=
"Material"
/>
<tabBarItem
title=
"Photo"
id=
"vsG-AI-jYq"
customClass=
"BottomNavigationBarItem"
customModule=
"Material"
/>
<tabBarItem
title=
"Library"
id=
"3fX-Ej-FRM"
customClass=
"BottomNavigationBarItem"
customModule=
"Material"
/>
<tabBarItem
title=
"Library"
id=
"3fX-Ej-FRM"
customClass=
"BottomNavigationBarItem"
customModule=
"Material"
/>
</items>
</items>
<color
key=
"barTintColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"calibratedWhite"
/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute
type=
"color"
keyPath=
"backgroundColor"
>
<userDefinedRuntimeAttribute
type=
"color"
keyPath=
"backgroundColor"
>
<color
key=
"value"
red=
"0.0"
green=
"0.56862745100000001"
blue=
"0.99607843139999996"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
key=
"value"
red=
"0.12941176470588234"
green=
"0.12941176470588234"
blue=
"0.12941176470588234"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute
type=
"number"
keyPath=
"height"
>
<real
key=
"value"
value=
"56"
/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</userDefinedRuntimeAttributes>
</tabBar>
</tabBar>
</subviews>
</subviews>
<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=
"sMP-AS-Zl9"
firstAttribute=
"centerX"
secondItem=
"8bC-Xf-vdC"
secondAttribute=
"centerX"
id=
"Kyz-7k-p0J"
/>
<constraint
firstItem=
"sMP-AS-Zl9"
firstAttribute=
"leading"
secondItem=
"8bC-Xf-vdC"
secondAttribute=
"leading"
id=
"8LA-GW-uqq"
/>
<constraint
firstItem=
"sMP-AS-Zl9"
firstAttribute=
"bottom"
secondItem=
"wfy-db-euE"
secondAttribute=
"top"
id=
"S7K-32-n4f"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"sMP-AS-Zl9"
secondAttribute=
"trailing"
id=
"oIw-fR-Dot"
/>
</constraints>
</constraints>
</view>
</view>
<connections>
<connections>
...
...
Examples/Storyboards/BottomNavigationBar/BottomNavigationBar/ViewController.swift
View file @
d5393fa0
...
@@ -41,8 +41,19 @@ class ViewController: UIViewController {
...
@@ -41,8 +41,19 @@ class ViewController: UIViewController {
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
videoItem
.
image
=
MaterialIcon
.
videocam
videoItem
.
image
=
MaterialIcon
.
videocam
videoItem
.
setTitleColor
(
MaterialColor
.
grey
.
base
,
forState
:
.
Normal
)
videoItem
.
setTitleColor
(
MaterialColor
.
teal
.
base
,
forState
:
.
Selected
)
photoItem
.
image
=
MaterialIcon
.
photoCamera
photoItem
.
image
=
MaterialIcon
.
photoCamera
photoItem
.
setTitleColor
(
MaterialColor
.
grey
.
base
,
forState
:
.
Normal
)
photoItem
.
setTitleColor
(
MaterialColor
.
teal
.
base
,
forState
:
.
Selected
)
libraryItem
.
image
=
MaterialIcon
.
photoLibrary
libraryItem
.
image
=
MaterialIcon
.
photoLibrary
libraryItem
.
setTitleColor
(
MaterialColor
.
grey
.
base
,
forState
:
.
Normal
)
libraryItem
.
setTitleColor
(
MaterialColor
.
teal
.
base
,
forState
:
.
Selected
)
bottomNavigationBar
.
tintColor
=
MaterialColor
.
teal
.
base
// Sets the image color when highlighted.
bottomNavigationBar
.
selectedItem
=
videoItem
}
}
}
}
...
...
Sources/BottomNavigationBar.swift
View file @
d5393fa0
...
@@ -126,7 +126,7 @@ public class BottomNavigationBar : UITabBar {
...
@@ -126,7 +126,7 @@ public class BottomNavigationBar : UITabBar {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
CGSize
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
}
}
...
...
Sources/MaterialColor.swift
View file @
d5393fa0
...
@@ -40,6 +40,22 @@ public struct MaterialColor {
...
@@ -40,6 +40,22 @@ public struct MaterialColor {
// black
// black
public
static
let
black
:
UIColor
=
UIColor
.
blackColor
()
public
static
let
black
:
UIColor
=
UIColor
.
blackColor
()
// dark text
public
struct
darkText
{
public
static
let
primary
:
UIColor
=
UIColor
.
blackColor
()
.
colorWithAlphaComponent
(
0.87
)
public
static
let
secondary
:
UIColor
=
UIColor
.
blackColor
()
.
colorWithAlphaComponent
(
0.54
)
public
static
let
others
:
UIColor
=
UIColor
.
blackColor
()
.
colorWithAlphaComponent
(
0.38
)
public
static
let
dividers
:
UIColor
=
UIColor
.
blackColor
()
.
colorWithAlphaComponent
(
0.12
)
}
// light text
public
struct
lightText
{
public
static
let
primary
:
UIColor
=
UIColor
.
whiteColor
()
public
static
let
secondary
:
UIColor
=
UIColor
.
whiteColor
()
.
colorWithAlphaComponent
(
0.7
)
public
static
let
others
:
UIColor
=
UIColor
.
whiteColor
()
.
colorWithAlphaComponent
(
0.5
)
public
static
let
dividers
:
UIColor
=
UIColor
.
whiteColor
()
.
colorWithAlphaComponent
(
0.12
)
}
// red
// red
public
struct
red
{
public
struct
red
{
public
static
let
lighten5
:
UIColor
=
UIColor
(
red
:
255
/
255
,
green
:
235
/
255
,
blue
:
238
/
255
,
alpha
:
1
)
public
static
let
lighten5
:
UIColor
=
UIColor
(
red
:
255
/
255
,
green
:
235
/
255
,
blue
:
238
/
255
,
alpha
:
1
)
...
@@ -371,20 +387,4 @@ public struct MaterialColor {
...
@@ -371,20 +387,4 @@ public struct MaterialColor {
public
static
let
darken3
:
UIColor
=
UIColor
(
red
:
55
/
255
,
green
:
71
/
255
,
blue
:
79
/
255
,
alpha
:
1
)
public
static
let
darken3
:
UIColor
=
UIColor
(
red
:
55
/
255
,
green
:
71
/
255
,
blue
:
79
/
255
,
alpha
:
1
)
public
static
let
darken4
:
UIColor
=
UIColor
(
red
:
38
/
255
,
green
:
50
/
255
,
blue
:
56
/
255
,
alpha
:
1
)
public
static
let
darken4
:
UIColor
=
UIColor
(
red
:
38
/
255
,
green
:
50
/
255
,
blue
:
56
/
255
,
alpha
:
1
)
}
}
// dark text
public
struct
darkText
{
public
static
let
primary
:
UIColor
=
UIColor
.
blackColor
()
.
colorWithAlphaComponent
(
0.87
)
public
static
let
secondary
:
UIColor
=
UIColor
.
blackColor
()
.
colorWithAlphaComponent
(
0.54
)
public
static
let
others
:
UIColor
=
UIColor
.
blackColor
()
.
colorWithAlphaComponent
(
0.38
)
public
static
let
dividers
:
UIColor
=
UIColor
.
blackColor
()
.
colorWithAlphaComponent
(
0.12
)
}
// light text
public
struct
lightText
{
public
static
let
primary
:
UIColor
=
UIColor
.
whiteColor
()
public
static
let
secondary
:
UIColor
=
UIColor
.
whiteColor
()
.
colorWithAlphaComponent
(
0.7
)
public
static
let
others
:
UIColor
=
UIColor
.
whiteColor
()
.
colorWithAlphaComponent
(
0.5
)
public
static
let
dividers
:
UIColor
=
UIColor
.
whiteColor
()
.
colorWithAlphaComponent
(
0.12
)
}
}
}
Sources/NavigationBar.swift
View file @
d5393fa0
...
@@ -164,7 +164,7 @@ public class NavigationBar : UINavigationBar {
...
@@ -164,7 +164,7 @@ public class NavigationBar : UINavigationBar {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
CGSize
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
}
}
...
...
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