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
d4a97c1e
Unverified
Commit
d4a97c1e
authored
Sep 19, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated example projects and internals for PageTabBarController
parent
351c905f
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
253 additions
and
30 deletions
+253
-30
Examples/Programmatic/BottomNavigationController/BottomNavigationController/ViewController.swift
+1
-1
Examples/Programmatic/CaptureController/CaptureController/ViewController.swift
+1
-1
Examples/Programmatic/MenuController/MenuController/RootViewController.swift
+1
-1
Examples/Programmatic/NavigationController/NavigationController/NextViewController.swift
+1
-1
Examples/Programmatic/NavigationController/NavigationController/RootViewController.swift
+1
-1
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/LeftViewController.swift
+1
-1
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/RightViewController.swift
+1
-1
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/RootViewController.swift
+1
-1
Examples/Programmatic/PageTabBarController/PageTabBarController.xcodeproj/project.pbxproj
+12
-4
Examples/Programmatic/PageTabBarController/PageTabBarController/AppDelegate.swift
+1
-1
Examples/Programmatic/PageTabBarController/PageTabBarController/AppPageTabBarController.swift
+13
-1
Examples/Programmatic/PageTabBarController/PageTabBarController/BlueViewController.swift
+19
-3
Examples/Programmatic/PageTabBarController/PageTabBarController/GreenViewController.swift
+56
-0
Examples/Programmatic/PageTabBarController/PageTabBarController/RedViewController.swift
+56
-0
Examples/Programmatic/PhotoLibraryController/PhotoLibraryController/ViewController.swift
+1
-1
Examples/Programmatic/RemindersController/RemindersController/ViewController.swift
+1
-1
Examples/Programmatic/SearchBarController/SearchBarController/RootViewController.swift
+30
-1
Examples/Programmatic/SnackbarController/SnackbarController/RootViewController.swift
+1
-1
Examples/Programmatic/StatusBarController/StatusBarController/RootViewController.swift
+1
-1
Examples/Programmatic/ToolbarController/ToolbarController/RootViewController.swift
+39
-1
Sources/iOS/NavigationItem.swift
+4
-2
Sources/iOS/PageTabBarController.swift
+7
-3
Sources/iOS/Toolbar.swift
+4
-2
No files found.
Examples/Programmatic/BottomNavigationController/BottomNavigationController/ViewController.swift
View file @
d4a97c1e
...
...
@@ -10,7 +10,7 @@ import UIKit
class
ViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
// Do any additional setup after loading the view, typically from a nib.
}
...
...
Examples/Programmatic/CaptureController/CaptureController/ViewController.swift
View file @
d4a97c1e
...
...
@@ -10,7 +10,7 @@ import UIKit
class
ViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
// Do any additional setup after loading the view, typically from a nib.
}
...
...
Examples/Programmatic/MenuController/MenuController/RootViewController.swift
View file @
d4a97c1e
...
...
@@ -41,7 +41,7 @@ class RootViewController: UIViewController {
/// A reference to the reminderMenuItem.
internal
var
reminderMenuItem
:
MenuItem
!
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
...
...
Examples/Programmatic/NavigationController/NavigationController/NextViewController.swift
View file @
d4a97c1e
...
...
@@ -32,7 +32,7 @@ import UIKit
import
Material
class
NextViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
base
...
...
Examples/Programmatic/NavigationController/NavigationController/RootViewController.swift
View file @
d4a97c1e
...
...
@@ -40,7 +40,7 @@ class RootViewController: UIViewController {
/// Trigger to go to the next view controller.
private
var
nextButton
:
FlatButton
!
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/LeftViewController.swift
View file @
d4a97c1e
...
...
@@ -32,7 +32,7 @@ import UIKit
import
Material
class
LeftViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
}
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/RightViewController.swift
View file @
d4a97c1e
...
...
@@ -32,7 +32,7 @@ import UIKit
import
Material
class
RightViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
blue
.
base
}
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/RootViewController.swift
View file @
d4a97c1e
...
...
@@ -32,7 +32,7 @@ import UIKit
import
Material
class
RootViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
}
...
...
Examples/Programmatic/PageTabBarController/PageTabBarController.xcodeproj/project.pbxproj
View file @
d4a97c1e
...
...
@@ -8,10 +8,12 @@
/* Begin PBXBuildFile section */
96784F021D9013E50061C06C
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F011D9013E50061C06C
/* AppDelegate.swift */
;
};
96784F041D9013E50061C06C
/* RootViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F031D9013E50061C06C
/* RootViewController.swift */
;
};
96784F091D9013E50061C06C
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F081D9013E50061C06C
/* Assets.xcassets */
;
};
96784F0C1D9013E50061C06C
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F0A1D9013E50061C06C
/* LaunchScreen.storyboard */
;
};
96784F261D901EC00061C06C
/* AppPageTabBarController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784F251D901EC00061C06C
/* AppPageTabBarController.swift */
;
};
96784FAD1D90257E0061C06C
/* RedViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FAC1D90257E0061C06C
/* RedViewController.swift */
;
};
96784FAF1D90258E0061C06C
/* GreenViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FAE1D90258E0061C06C
/* GreenViewController.swift */
;
};
96784FB11D9025A60061C06C
/* BlueViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96784FB01D9025A60061C06C
/* BlueViewController.swift */
;
};
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
...
...
@@ -30,11 +32,13 @@
/* Begin PBXFileReference section */
96784EFE1D9013E50061C06C
/* PageTabBarController.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
PageTabBarController.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
96784F011D9013E50061C06C
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
96784F031D9013E50061C06C
/* RootViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RootViewController.swift
;
sourceTree
=
"<group>"
;
};
96784F081D9013E50061C06C
/* Assets.xcassets */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder.assetcatalog
;
path
=
Assets.xcassets
;
sourceTree
=
"<group>"
;
};
96784F0B1D9013E50061C06C
/* Base */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.storyboard
;
name
=
Base
;
path
=
Base.lproj/LaunchScreen.storyboard
;
sourceTree
=
"<group>"
;
};
96784F0D1D9013E50061C06C
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
96784F251D901EC00061C06C
/* AppPageTabBarController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppPageTabBarController.swift
;
sourceTree
=
"<group>"
;
};
96784FAC1D90257E0061C06C
/* RedViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RedViewController.swift
;
sourceTree
=
"<group>"
;
};
96784FAE1D90258E0061C06C
/* GreenViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GreenViewController.swift
;
sourceTree
=
"<group>"
;
};
96784FB01D9025A60061C06C
/* BlueViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BlueViewController.swift
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
...
...
@@ -69,7 +73,9 @@
children
=
(
96784F011D9013E50061C06C
/* AppDelegate.swift */
,
96784F251D901EC00061C06C
/* AppPageTabBarController.swift */
,
96784F031D9013E50061C06C
/* RootViewController.swift */
,
96784FAC1D90257E0061C06C
/* RedViewController.swift */
,
96784FAE1D90258E0061C06C
/* GreenViewController.swift */
,
96784FB01D9025A60061C06C
/* BlueViewController.swift */
,
96784F081D9013E50061C06C
/* Assets.xcassets */
,
96784F0A1D9013E50061C06C
/* LaunchScreen.storyboard */
,
96784F0D1D9013E50061C06C
/* Info.plist */
,
...
...
@@ -149,9 +155,11 @@
isa
=
PBXSourcesBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
96784F
041D9013E50061C06C
/* Root
ViewController.swift in Sources */
,
96784F
AD1D90257E0061C06C
/* Red
ViewController.swift in Sources */
,
96784F021D9013E50061C06C
/* AppDelegate.swift in Sources */
,
96784F261D901EC00061C06C
/* AppPageTabBarController.swift in Sources */
,
96784FB11D9025A60061C06C
/* BlueViewController.swift in Sources */
,
96784FAF1D90258E0061C06C
/* GreenViewController.swift in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
Examples/Programmatic/PageTabBarController/PageTabBarController/AppDelegate.swift
View file @
d4a97c1e
...
...
@@ -38,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
applicationDidFinishLaunching
(
_
application
:
UIApplication
)
{
window
=
UIWindow
(
frame
:
Device
.
bounds
)
window
!.
rootViewController
=
AppPageTabBarController
(
rootViewController
:
RootViewController
()
)
window
!.
rootViewController
=
AppPageTabBarController
(
viewControllers
:
[
RedViewController
(),
GreenViewController
(),
BlueViewController
()],
selectedIndex
:
0
)
window
!.
makeKeyAndVisible
()
}
...
...
Examples/Programmatic/PageTabBarController/PageTabBarController/AppPageTabBarController.swift
View file @
d4a97c1e
...
...
@@ -34,7 +34,19 @@ import Material
class
AppPageTabBarController
:
PageTabBarController
{
open
override
func
prepare
()
{
super
.
prepare
()
statusBarStyle
=
.
default
delegate
=
self
preparePageTabBar
()
}
/// Prepares the pageTabBar.
private
func
preparePageTabBar
()
{
pageTabBar
.
lineColor
=
Color
.
purple
.
base
}
}
extension
AppPageTabBarController
:
PageTabBarControllerDelegate
{
func
pageTabBarController
(
pageTabBarController
:
PageTabBarController
,
didTransitionTo
viewController
:
UIViewController
)
{
print
(
"pageTabBarController"
,
pageTabBarController
,
"didTransitionTo viewController:"
,
viewController
)
}
}
Examples/Programmatic/PageTabBarController/PageTabBarController/
Root
ViewController.swift
→
Examples/Programmatic/PageTabBarController/PageTabBarController/
Blue
ViewController.swift
View file @
d4a97c1e
...
...
@@ -31,10 +31,26 @@
import
UIKit
import
Material
class
RootViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
class
BlueViewController
:
UIViewController
{
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
preparePageTabBarItem
()
}
init
()
{
super
.
init
(
nibName
:
nil
,
bundle
:
nil
)
preparePageTabBarItem
()
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
view
.
backgroundColor
=
Color
.
blue
.
base
}
/// Prepares the pageTabBarItem.
internal
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Blue"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
}
}
Examples/Programmatic/PageTabBarController/PageTabBarController/GreenViewController.swift
0 → 100644
View file @
d4a97c1e
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
import
Material
class
GreenViewController
:
UIViewController
{
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
preparePageTabBarItem
()
}
init
()
{
super
.
init
(
nibName
:
nil
,
bundle
:
nil
)
preparePageTabBarItem
()
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
green
.
base
}
/// Prepares the pageTabBarItem.
internal
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Green"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
}
}
Examples/Programmatic/PageTabBarController/PageTabBarController/RedViewController.swift
0 → 100644
View file @
d4a97c1e
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
import
Material
class
RedViewController
:
UIViewController
{
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
preparePageTabBarItem
()
}
init
()
{
super
.
init
(
nibName
:
nil
,
bundle
:
nil
)
preparePageTabBarItem
()
}
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
red
.
base
}
/// Prepares the pageTabBarItem.
internal
func
preparePageTabBarItem
()
{
pageTabBarItem
.
title
=
"Red"
pageTabBarItem
.
titleColor
=
Color
.
blueGrey
.
base
}
}
Examples/Programmatic/PhotoLibraryController/PhotoLibraryController/ViewController.swift
View file @
d4a97c1e
...
...
@@ -10,7 +10,7 @@ import UIKit
class
ViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
// Do any additional setup after loading the view, typically from a nib.
}
...
...
Examples/Programmatic/RemindersController/RemindersController/ViewController.swift
View file @
d4a97c1e
...
...
@@ -10,7 +10,7 @@ import UIKit
class
ViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
// Do any additional setup after loading the view, typically from a nib.
}
...
...
Examples/Programmatic/SearchBarController/SearchBarController/RootViewController.swift
View file @
d4a97c1e
...
...
@@ -32,9 +32,38 @@ import UIKit
import
Material
class
RootViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
/// SearchBar buttons.
private
var
menuButton
:
IconButton
!
private
var
moreButton
:
IconButton
!
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
}
open
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
prepareMenuButton
()
prepareMoreButton
()
prepareSearchBar
()
}
private
func
prepareMenuButton
()
{
menuButton
=
IconButton
(
image
:
Icon
.
cm
.
menu
,
tintColor
:
Color
.
blue
.
base
)
}
private
func
prepareMoreButton
()
{
moreButton
=
IconButton
(
image
:
Icon
.
cm
.
moreVertical
,
tintColor
:
Color
.
blue
.
base
)
}
private
func
prepareSearchBar
()
{
guard
let
sc
=
searchBarController
else
{
return
}
sc
.
searchBar
.
leftViews
=
[
menuButton
]
sc
.
searchBar
.
rightViews
=
[
moreButton
]
}
}
Examples/Programmatic/SnackbarController/SnackbarController/RootViewController.swift
View file @
d4a97c1e
...
...
@@ -35,7 +35,7 @@ class RootViewController: UIViewController {
/// A reference to the Undo button.
private
var
undoButton
:
FlatButton
!
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
...
...
Examples/Programmatic/StatusBarController/StatusBarController/RootViewController.swift
View file @
d4a97c1e
...
...
@@ -32,7 +32,7 @@ import UIKit
import
Material
class
RootViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
o
pen
o
verride
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
}
...
...
Examples/Programmatic/ToolbarController/ToolbarController/RootViewController.swift
View file @
d4a97c1e
...
...
@@ -32,9 +32,47 @@ import UIKit
import
Material
class
RootViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
/// Toolbar buttons.
private
var
menuButton
:
IconButton
!
private
var
starButton
:
IconButton
!
private
var
searchButton
:
IconButton
!
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
view
.
backgroundColor
=
Color
.
grey
.
lighten1
}
open
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
prepareMenuButton
()
prepareStarButton
()
prepareSearchButton
()
prepareToolbar
()
}
private
func
prepareMenuButton
()
{
menuButton
=
IconButton
(
image
:
Icon
.
cm
.
menu
,
tintColor
:
Color
.
blue
.
base
)
}
private
func
prepareStarButton
()
{
starButton
=
IconButton
(
image
:
Icon
.
cm
.
star
,
tintColor
:
Color
.
blue
.
base
)
}
private
func
prepareSearchButton
()
{
searchButton
=
IconButton
(
image
:
Icon
.
cm
.
search
,
tintColor
:
Color
.
blue
.
base
)
}
private
func
prepareToolbar
()
{
guard
let
tc
=
toolbarController
else
{
return
}
tc
.
toolbar
.
title
=
"Marterial"
tc
.
toolbar
.
detail
=
"Build Beautiful Software"
tc
.
toolbar
.
leftViews
=
[
menuButton
]
tc
.
toolbar
.
rightViews
=
[
starButton
,
searchButton
]
}
}
Sources/iOS/NavigationItem.swift
View file @
d4a97c1e
...
...
@@ -98,17 +98,19 @@ public class NavigationItem: NSObject {
/// Prepares the titleLabel.
private
func
prepareTitleLabel
()
{
titleLabel
.
font
=
RobotoFont
.
medium
(
with
:
17
)
titleLabel
.
textAlignment
=
.
center
titleLabel
.
contentScaleFactor
=
Device
.
scale
titleLabel
.
font
=
RobotoFont
.
medium
(
with
:
17
)
titleLabel
.
textColor
=
Color
.
darkText
.
primary
addObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
,
options
:
[],
context
:
&
NavigationItemContext
)
}
/// Prepares the detailLabel.
private
func
prepareDetailLabel
()
{
detailLabel
.
textAlignment
=
.
center
titleLabel
.
contentScaleFactor
=
Device
.
scale
detailLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
detailLabel
.
textColor
=
Color
.
darkText
.
secondary
detailLabel
.
textAlignment
=
.
center
}
}
...
...
Sources/iOS/PageTabBarController.swift
View file @
d4a97c1e
...
...
@@ -125,19 +125,22 @@ open class PageTabBarController: RootController {
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
prepare
()
}
public
override
init
(
rootViewController
:
UIViewController
)
{
super
.
init
(
rootViewController
:
UIPageViewController
(
transitionStyle
:
.
scroll
,
navigationOrientation
:
.
horizontal
,
options
:
nil
))
viewControllers
.
append
(
rootViewController
)
setViewControllers
(
viewControllers
,
direction
:
.
forward
,
animated
:
true
)
prepare
()
}
public
init
(
viewControllers
:
[
UIViewController
],
selectedIndex
:
Int
,
direction
:
UIPageViewControllerNavigationDirection
,
animated
:
Bool
)
{
public
init
(
viewControllers
:
[
UIViewController
],
selectedIndex
:
Int
)
{
super
.
init
(
rootViewController
:
UIPageViewController
(
transitionStyle
:
.
scroll
,
navigationOrientation
:
.
horizontal
,
options
:
nil
))
self
.
selectedIndex
=
selectedIndex
self
.
viewControllers
.
append
(
contentsOf
:
viewControllers
)
setViewControllers
([
self
.
viewControllers
[
selectedIndex
]],
direction
:
direction
,
animated
:
animated
)
setViewControllers
([
self
.
viewControllers
[
selectedIndex
]],
direction
:
.
forward
,
animated
:
true
)
prepare
()
}
/**
...
...
@@ -175,7 +178,7 @@ open class PageTabBarController: RootController {
*/
open
func
setViewControllers
(
_
viewControllers
:
[
UIViewController
],
direction
:
UIPageViewControllerNavigationDirection
,
animated
:
Bool
,
completion
:
((
Bool
)
->
Void
)?
=
nil
)
{
pageViewController
?
.
setViewControllers
(
viewControllers
,
direction
:
direction
,
animated
:
animated
,
completion
:
completion
)
prepare
PageTabBarItems
()
prepare
()
}
/**
...
...
@@ -188,6 +191,7 @@ open class PageTabBarController: RootController {
open
override
func
prepare
()
{
super
.
prepare
()
preparePageTabBar
()
preparePageTabBarItems
()
}
override
func
prepareRootViewController
()
{
...
...
Sources/iOS/Toolbar.swift
View file @
d4a97c1e
...
...
@@ -158,16 +158,18 @@ open class Toolbar: BarView {
/// Prepares the titleLabel.
private
func
prepareTitleLabel
()
{
titleLabel
.
textAlignment
=
.
center
titleLabel
.
contentScaleFactor
=
Device
.
scale
titleLabel
.
font
=
RobotoFont
.
medium
(
with
:
17
)
titleLabel
.
text
Alignment
=
.
center
titleLabel
.
text
Color
=
Color
.
darkText
.
primary
addObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
,
options
:
[],
context
:
&
ToolbarContext
)
}
/// Prepares the detailLabel.
private
func
prepareDetailLabel
()
{
detailLabel
.
textAlignment
=
.
center
detailLabel
.
contentScaleFactor
=
Device
.
scale
detailLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
detailLabel
.
text
Alignment
=
.
center
detailLabel
.
text
Color
=
Color
.
darkText
.
secondary
}
}
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