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
27ea4ba1
Unverified
Commit
27ea4ba1
authored
Feb 04, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: fixed UIImage context issue when creating translucent image
parent
7e8a98ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
Sources/iOS/Material+UIImage.swift
+12
-2
Sources/iOS/NavigationBar.swift
+1
-2
Sources/iOS/NavigationController.swift
+2
-1
No files found.
Sources/iOS/Material+UIImage.swift
View file @
27ea4ba1
...
@@ -131,10 +131,20 @@ extension UIImage {
...
@@ -131,10 +131,20 @@ extension UIImage {
- Returns: A UIImage that is the color passed in.
- Returns: A UIImage that is the color passed in.
*/
*/
open
class
func
image
(
with
color
:
UIColor
,
size
:
CGSize
)
->
UIImage
?
{
open
class
func
image
(
with
color
:
UIColor
,
size
:
CGSize
)
->
UIImage
?
{
UIGraphicsBeginImageContextWithOptions
(
size
,
false
,
Screen
.
scale
)
guard
let
context
=
UIGraphicsGetCurrentContext
()
else
{
return
nil
}
context
.
scaleBy
(
x
:
1.0
,
y
:
-
1.0
)
context
.
translateBy
(
x
:
0.0
,
y
:
-
size
.
height
)
context
.
setBlendMode
(
.
multiply
)
let
rect
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
size
.
width
,
height
:
size
.
height
)
let
rect
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
size
.
width
,
height
:
size
.
height
)
UIGraphicsBeginImageContextWithOptions
(
size
,
false
,
0
)
color
.
setFill
()
color
.
setFill
()
UIRectFill
(
rect
)
context
.
fill
(
rect
)
let
image
=
UIGraphicsGetImageFromCurrentImageContext
()
let
image
=
UIGraphicsGetImageFromCurrentImageContext
()
UIGraphicsEndImageContext
()
UIGraphicsEndImageContext
()
return
image
?
.
withRenderingMode
(
.
alwaysOriginal
)
return
image
?
.
withRenderingMode
(
.
alwaysOriginal
)
...
...
Sources/iOS/NavigationBar.swift
View file @
27ea4ba1
...
@@ -287,13 +287,12 @@ open class NavigationBar: UINavigationBar {
...
@@ -287,13 +287,12 @@ open class NavigationBar: UINavigationBar {
*/
*/
open
func
prepare
()
{
open
func
prepare
()
{
barStyle
=
.
black
barStyle
=
.
black
isTranslucent
=
false
depthPreset
=
.
depth1
depthPreset
=
.
depth1
interimSpacePreset
=
.
interimSpace3
interimSpacePreset
=
.
interimSpace3
contentEdgeInsetsPreset
=
.
square1
contentEdgeInsetsPreset
=
.
square1
contentScaleFactor
=
Screen
.
scale
contentScaleFactor
=
Screen
.
scale
backButtonImage
=
Icon
.
cm
.
arrowBack
backButtonImage
=
Icon
.
cm
.
arrowBack
let
image
=
UIImage
.
image
(
with
:
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
let
image
=
UIImage
.
image
(
with
:
.
clear
,
size
:
CGSize
(
width
:
bounds
.
width
,
height
:
bounds
.
height
))
shadowImage
=
image
shadowImage
=
image
setBackgroundImage
(
image
,
for
:
.
default
)
setBackgroundImage
(
image
,
for
:
.
default
)
backgroundColor
=
.
white
backgroundColor
=
.
white
...
...
Sources/iOS/NavigationController.swift
View file @
27ea4ba1
...
@@ -108,7 +108,8 @@ open class NavigationController: UINavigationController {
...
@@ -108,7 +108,8 @@ open class NavigationController: UINavigationController {
open
override
func
viewWillLayoutSubviews
()
{
open
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
super
.
viewWillLayoutSubviews
()
navigationBar
.
width
=
view
.
width
navigationBar
.
setNeedsLayout
()
navigationBar
.
layoutIfNeeded
()
}
}
/**
/**
...
...
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