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
b1f7f4c2
Commit
b1f7f4c2
authored
Mar 15, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated bundle reference for CocoaPods
parent
bcd19bd8
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
76 additions
and
52 deletions
+76
-52
Examples/Programmatic/App/App/AppSearchBarViewController.swift
+5
-16
Material.podspec
+3
-0
Material.xcodeproj/project.pbxproj
+8
-0
Resources/AppIcon/Material-Icon-29.png
+0
-0
Resources/AppIcon/Material-Icon-29@2x.png
+0
-0
Resources/AppIcon/Material-Icon-29@3x.png
+0
-0
Resources/AppIcon/Material-Icon-40.png
+0
-0
Resources/AppIcon/Material-Icon-40@2x.png
+0
-0
Resources/AppIcon/Material-Icon-40@3x.png
+0
-0
Resources/AppIcon/Material-Icon-60@2x.png
+0
-0
Resources/AppIcon/Material-Icon-60@3x.png
+0
-0
Resources/AppIcon/Material-Icon-76.png
+0
-0
Resources/AppIcon/Material-Icon-76@2x.png
+0
-0
Resources/AppIcon/Material-Icon-83.5@2x.png
+0
-0
Resources/AppIcon/Material-iTunesArtWork.png
+0
-0
Sources/MaterialColor.swift
+2
-2
Sources/NavigationBar.swift
+0
-1
Sources/SideNavigationViewController.swift
+57
-32
Sources/TextField.swift
+1
-1
No files found.
Examples/Programmatic/App/App/AppSearchBarViewController.swift
View file @
b1f7f4c2
...
...
@@ -52,25 +52,20 @@ class AppSearchBarController: SearchBarController {
override
func
viewWillAppear
(
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
searchBar
.
statusBarStyle
=
.
Default
searchBar
.
textField
.
becomeFirstResponder
()
sideNavigationController
?
.
delegate
=
self
sideNavigationController
?
.
enabled
=
false
}
override
func
viewDidAppear
(
animated
:
Bool
)
{
super
.
viewDidAppear
(
animated
)
searchBar
.
textField
.
becomeFirstResponder
()
}
/// Toggle SideSearchViewController left UIViewController.
internal
func
handleBackButton
()
{
searchBar
.
textField
.
resignFirstResponder
()
dismissViewControllerAnimated
(
true
,
completion
:
nil
)
}
/// Toggle SideSearchViewController right UIViewController.
internal
func
handleMoreButton
()
{
searchBar
.
textField
.
resignFirstResponder
()
print
(
presentingViewController
?
.
view
.
layer
.
zPosition
)
sideNavigationController
?
.
enabledRightView
=
true
sideNavigationController
?
.
toggleRightView
()
}
/// Prepares view.
override
func
prepareView
()
{
super
.
prepareView
()
...
...
@@ -131,9 +126,3 @@ extension AppSearchBarController: TextFieldDelegate {
print
(
"End searching...."
)
}
}
extension
AppSearchBarController
:
SideNavigationControllerDelegate
{
func
sideNavigationDidClose
(
sideNavigationController
:
SideNavigationController
,
position
:
SideNavigationPosition
)
{
sideNavigationController
.
enabled
=
false
}
}
Material.podspec
View file @
b1f7f4c2
...
...
@@ -10,4 +10,7 @@ Pod::Spec.new do |s|
s
.
ios
.
deployment_target
=
'8.0'
s
.
source_files
=
'Sources/*.swift'
s
.
requires_arc
=
true
s
.
resource_bundles
=
{
'io.cosmicmind.Material'
=>
[
'Sources/Assets.xcassets/**/*.png'
]
}
end
Material.xcodeproj/project.pbxproj
View file @
b1f7f4c2
...
...
@@ -341,6 +341,13 @@
name
=
Grid
;
sourceTree
=
"<group>"
;
};
9666D3961C99297000F50E0E
/* Assets */
=
{
isa
=
PBXGroup
;
children
=
(
);
name
=
Assets
;
sourceTree
=
"<group>"
;
};
966F57B61C226D65009185B7
/* Text */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -402,6 +409,7 @@
96D88BF41C1328D800B91418
/* Sources */
=
{
isa
=
PBXGroup
;
children
=
(
9666D3961C99297000F50E0E
/* Assets */
,
96D88BFD1C1328D800B91418
/* LICENSE */
,
96D88BFC1C1328D800B91418
/* Info.plist */
,
96D88C091C1328D800B91418
/* Material.h */
,
...
...
Resources/Material-Icon-29.png
→
Resources/
AppIcon/
Material-Icon-29.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-29@2x.png
→
Resources/
AppIcon/
Material-Icon-29@2x.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-29@3x.png
→
Resources/
AppIcon/
Material-Icon-29@3x.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-40.png
→
Resources/
AppIcon/
Material-Icon-40.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-40@2x.png
→
Resources/
AppIcon/
Material-Icon-40@2x.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-40@3x.png
→
Resources/
AppIcon/
Material-Icon-40@3x.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-60@2x.png
→
Resources/
AppIcon/
Material-Icon-60@2x.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-60@3x.png
→
Resources/
AppIcon/
Material-Icon-60@3x.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-76.png
→
Resources/
AppIcon/
Material-Icon-76.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-76@2x.png
→
Resources/
AppIcon/
Material-Icon-76@2x.png
View file @
b1f7f4c2
File moved
Resources/Material-Icon-83.5@2x.png
→
Resources/
AppIcon/
Material-Icon-83.5@2x.png
View file @
b1f7f4c2
File moved
Resources/Material-iTunesArtWork.png
→
Resources/
AppIcon/
Material-iTunesArtWork.png
View file @
b1f7f4c2
File moved
Sources/MaterialColor.swift
View file @
b1f7f4c2
...
...
@@ -35,10 +35,10 @@ public struct MaterialColor {
public
static
let
clear
:
UIColor
=
UIColor
.
clearColor
()
// white
public
static
let
white
:
UIColor
=
UIColor
(
red
:
255
/
255
,
green
:
255
/
255
,
blue
:
255
/
255
,
alpha
:
1
)
public
static
let
white
:
UIColor
=
UIColor
.
whiteColor
(
)
// black
public
static
let
black
:
UIColor
=
UIColor
(
red
:
0
/
255
,
green
:
0
/
255
,
blue
:
0
/
255
,
alpha
:
1
)
public
static
let
black
:
UIColor
=
UIColor
.
blackColor
(
)
// red
public
struct
red
{
...
...
Sources/NavigationBar.swift
View file @
b1f7f4c2
...
...
@@ -297,7 +297,6 @@ public class NavigationBar : UINavigationBar {
item
.
titleView
=
UIView
(
frame
:
CGRectMake
(
0
,
contentInset
.
top
,
MaterialDevice
.
width
<
MaterialDevice
.
height
?
MaterialDevice
.
height
:
MaterialDevice
.
width
,
intrinsicContentSize
()
.
height
-
contentInset
.
top
-
contentInset
.
bottom
))
item
.
titleView
!.
autoresizingMask
=
[
.
FlexibleWidth
]
item
.
titleView
!.
grid
.
axis
.
direction
=
.
Vertical
item
.
titleView
!.
backgroundColor
=
MaterialColor
.
green
.
base
// TitleView alignment.
if
let
t
:
UILabel
=
item
.
titleLabel
{
...
...
Sources/SideNavigationViewController.swift
View file @
b1f7f4c2
...
...
@@ -211,7 +211,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
A Boolean property that triggers the status bar to be hidden
when the leftView is opened. Defaults to true.
*/
@IBInspectable
public
var
hideStatusB
ar
:
Bool
=
true
@IBInspectable
public
var
enableHideStatusb
ar
:
Bool
=
true
/**
A MaterialDepth property that is used to set the depth of the
...
...
@@ -305,6 +305,18 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
layoutSubviews
()
}
public
override
func
viewWillTransitionToSize
(
size
:
CGSize
,
withTransitionCoordinator
coordinator
:
UIViewControllerTransitionCoordinator
)
{
super
.
viewWillTransitionToSize
(
size
,
withTransitionCoordinator
:
coordinator
)
if
!
MaterialDevice
.
landscape
&&
.
iPhone
==
MaterialDevice
.
type
{
hideStatusBar
()
}
else
{
showStatusBar
()
}
if
let
v
:
MaterialView
=
rightView
{
v
.
x
=
size
.
width
-
(
openedRightView
?
rightViewWidth
:
0
)
}
}
/**
A method to swap mainViewController objects.
- Parameter toViewController: The UIViewController to swap
...
...
@@ -497,7 +509,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
public
func
openLeftView
(
velocity
:
CGFloat
=
0
)
{
if
enabledLeftView
{
if
let
v
:
MaterialView
=
leftView
{
toggleStatusBar
(
true
)
hideStatusBar
(
)
showView
(
v
)
delegate
?
.
sideNavigationWillOpen
?(
self
,
position
:
.
Left
)
...
...
@@ -521,7 +533,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
public
func
openRightView
(
velocity
:
CGFloat
=
0
)
{
if
enabledRightView
{
if
let
v
:
MaterialView
=
rightView
{
toggleStatusBar
(
true
)
hideStatusBar
(
)
showView
(
v
)
delegate
?
.
sideNavigationWillOpen
?(
self
,
position
:
.
Right
)
...
...
@@ -551,8 +563,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
animations
:
{
v
.
position
.
x
=
-
v
.
width
/
2
})
{
[
unowned
self
]
_
in
self
.
toggleStatusBar
(
MaterialDevice
.
landscape
&&
.
iPhone
==
MaterialDevice
.
type
)
self
.
hideView
(
v
)
self
.
toggleStatusBar
()
self
.
delegate
?
.
sideNavigationDidClose
?(
self
,
position
:
.
Left
)
}
}
...
...
@@ -574,8 +586,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
animations
:
{
[
unowned
self
]
in
v
.
position
.
x
=
self
.
view
.
bounds
.
width
+
v
.
width
/
2
})
{
[
unowned
self
]
_
in
self
.
toggleStatusBar
(
MaterialDevice
.
landscape
&&
.
iPhone
==
MaterialDevice
.
type
)
self
.
hideView
(
v
)
self
.
toggleStatusBar
()
self
.
delegate
?
.
sideNavigationDidClose
?(
self
,
position
:
.
Right
)
}
}
...
...
@@ -612,7 +624,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
case
.
Began
:
originalX
=
v
.
position
.
x
toggleStatusBar
(
true
)
hideStatusBar
(
)
showView
(
v
)
delegate
?
.
sideNavigationPanDidBegin
?(
self
,
point
:
point
,
position
:
.
Right
)
...
...
@@ -649,7 +661,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
case
.
Began
:
originalX
=
v
.
position
.
x
toggleStatusBar
(
true
)
hideStatusBar
(
)
showView
(
v
)
delegate
?
.
sideNavigationPanDidBegin
?(
self
,
point
:
point
,
position
:
.
Left
)
...
...
@@ -819,32 +831,45 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
}
}
/**
A method to toggle the status bar from a reveal state to
hidden state. The hideStatusBar property needs to be set
to true in order for this method to have any affect.
- Parameter hide: A Boolean indicating to show or hide
the status bar.
*/
private
func
toggleStatusBar
(
hide
:
Bool
=
false
)
{
// if hideStatusBar {
// userInteractionEnabled = false
// let hidden: Bool = opened ? true : hide
// UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
// animations: { [weak self] in
// self?.setNeedsStatusBarAppearanceUpdate()
// MaterialDevice.statusBarHidden = hidden
// }) { [weak self] _ in
// if false == self?.opened {
// self?.userInteractionEnabled = true
// }
// }
// delegate?.sideNavigationStatusBarHiddenState?(self, hidden: hidden)
// }
/// Shows the statusBar.
private
func
showStatusBar
()
{
userInteractionEnabled
=
false
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
MaterialDevice
.
statusBarHidden
=
false
})
{
[
weak
self
]
_
in
if
false
==
self
?
.
opened
{
self
?
.
userInteractionEnabled
=
true
}
}
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
false
)
}
/// Hides the statusBar.
private
func
hideStatusBar
()
{
if
enableHideStatusbar
{
userInteractionEnabled
=
false
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
MaterialDevice
.
statusBarHidden
=
true
})
{
[
weak
self
]
_
in
if
false
==
self
?
.
opened
{
self
?
.
userInteractionEnabled
=
true
}
}
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
true
)
}
}
public
override
func
preferredStatusBarUpdateAnimation
()
->
UIStatusBarAnimation
{
return
.
Fade
/// Toggles the statusBar
private
func
toggleStatusBar
()
{
if
MaterialDevice
.
landscape
&&
.
iPhone
==
MaterialDevice
.
type
{
hideStatusBar
()
}
else
{
showStatusBar
()
}
}
/**
...
...
@@ -909,7 +934,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/// Layout subviews.
private
func
layoutSubviews
()
{
toggleStatusBar
(
MaterialDevice
.
landscape
&&
.
iPhone
==
MaterialDevice
.
type
)
toggleStatusBar
()
if
let
v
:
MaterialView
=
leftView
{
v
.
width
=
leftViewWidth
...
...
Sources/TextField.swift
View file @
b1f7f4c2
...
...
@@ -521,7 +521,7 @@ public class TextField : UITextField {
public
func
reloadView
()
{
/// Prepare the clearButton.
if
let
v
:
UIButton
=
clearButton
{
v
.
frame
=
CGRectMake
(
0
,
0
,
height
,
height
)
v
.
frame
=
CGRectMake
(
width
-
height
,
0
,
height
,
height
)
}
}
...
...
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