Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2022-10-10 16:45:57 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4800ab0b0d642ab6b528e15e8472e74f93024c9b
4800ab0b
1 parent
a56c4ccd
fix back button image
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
31 deletions
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/ViewControllerExtensions.swift
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
4800ab0
...
...
@@ -7,7 +7,7 @@
<key>
Pods-SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
0
</integer>
<integer>
1
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
4800ab0
...
...
@@ -7,7 +7,7 @@
<key>
SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
1
</integer>
<integer>
0
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
4800ab0
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/ViewControllerExtensions.swift
View file @
4800ab0
...
...
@@ -9,39 +9,58 @@ import UIKit
extension
UIViewController
{
func
setBackButton
(
_
icon
:
String
=
"ic_back_2"
)
{
let
uiscreen
:
CGRect
=
UIScreen
.
main
.
bounds
//
let uiscreen: CGRect = UIScreen.main.bounds
let
backButton
=
UIButton
(
type
:
UIButton
.
ButtonType
.
custom
)
as
UIButton
if
(
icon
==
"ic_close_2"
)
{
backButton
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
18
,
height
:
18
)
}
else
{
backButton
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
18
,
height
:
18
)
}
// backButton.frame = CGRect(x: 0, y: 0, width: uiscreen.height * 0.01, height: uiscreen.height * 0.01)
// backButton.backgroundColor = .red
backButton
.
imageView
!.
contentMode
=
.
scaleAspectFit
//backButton.setBackgroundImage(UIImage(named:Assets.Navigation.backButton), for: UIControlState())
// backButton.setImage(UIImage(named: icon), for: .normal)
backButton
.
setBackgroundImage
(
UIImage
(
named
:
icon
),
for
:
.
normal
)
// backButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: -20, bottom: 0, right: 0)
backButton
.
addTarget
(
self
,
action
:
#selector(
moveToBack(_:)
)
,
for
:
.
touchUpInside
)
//
let backButton = UIButton(type: UIButton.ButtonType.custom) as UIButton
//
if (icon == "ic_close_2") {
//
backButton.frame = CGRect(x: 0, y: 0, width: 18, height: 18)
//
} else {
//
backButton.frame = CGRect(x: 0, y: 0, width: 18, height: 18)
//
}
//
//
backButton.frame = CGRect(x: 0, y: 0, width: uiscreen.height * 0.01, height: uiscreen.height * 0.01)
//
// backButton.backgroundColor = .red
//
backButton.imageView!.contentMode = .scaleAspectFit
//
//backButton.setBackgroundImage(UIImage(named:Assets.Navigation.backButton), for: UIControlState())
//
//
backButton.setImage(UIImage(named: icon), for: .normal)
//
backButton.setBackgroundImage(UIImage(named: icon), for: .normal)
//
//
backButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: -20, bottom: 0, right: 0)
//
backButton.addTarget(self, action: #selector(moveToBack(_:)), for: .touchUpInside)
backButton
.
translatesAutoresizingMaskIntoConstraints
=
false
// Add width, height constraints
if
(
icon
==
"ic_close_2"
)
{
let
widthContraints
=
NSLayoutConstraint
(
item
:
backButton
,
attribute
:
NSLayoutConstraint
.
Attribute
.
width
,
relatedBy
:
NSLayoutConstraint
.
Relation
.
equal
,
toItem
:
nil
,
attribute
:
NSLayoutConstraint
.
Attribute
.
notAnAttribute
,
multiplier
:
1
,
constant
:
18
)
let
heightContraints
=
NSLayoutConstraint
(
item
:
backButton
,
attribute
:
NSLayoutConstraint
.
Attribute
.
height
,
relatedBy
:
NSLayoutConstraint
.
Relation
.
equal
,
toItem
:
nil
,
attribute
:
NSLayoutConstraint
.
Attribute
.
notAnAttribute
,
multiplier
:
1
,
constant
:
18
)
NSLayoutConstraint
.
activate
([
heightContraints
,
widthContraints
])
}
else
{
let
widthContraints
=
NSLayoutConstraint
(
item
:
backButton
,
attribute
:
NSLayoutConstraint
.
Attribute
.
width
,
relatedBy
:
NSLayoutConstraint
.
Relation
.
equal
,
toItem
:
nil
,
attribute
:
NSLayoutConstraint
.
Attribute
.
notAnAttribute
,
multiplier
:
1
,
constant
:
18
)
let
heightContraints
=
NSLayoutConstraint
(
item
:
backButton
,
attribute
:
NSLayoutConstraint
.
Attribute
.
height
,
relatedBy
:
NSLayoutConstraint
.
Relation
.
equal
,
toItem
:
nil
,
attribute
:
NSLayoutConstraint
.
Attribute
.
notAnAttribute
,
multiplier
:
1
,
constant
:
18
)
NSLayoutConstraint
.
activate
([
heightContraints
,
widthContraints
])
}
//
backButton.translatesAutoresizingMaskIntoConstraints = false
//
// Add width, height constraints
//
if (icon == "ic_close_2") {
//
let widthContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: 18)
//
let heightContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.height, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: 18)
//
NSLayoutConstraint.activate([heightContraints,widthContraints])
//
} else {
//
let widthContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: 18)
//
let heightContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.height, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: 18)
//
NSLayoutConstraint.activate([heightContraints,widthContraints])
//
}
let
leftBarButtonItem
:
UIBarButtonItem
=
UIBarButtonItem
(
customView
:
backButton
)
NSLayoutConstraint
.
activate
([(
leftBarButtonItem
.
customView
!.
widthAnchor
.
constraint
(
equalToConstant
:
18
)),(
leftBarButtonItem
.
customView
!.
heightAnchor
.
constraint
(
equalToConstant
:
18
))])
self
.
navigationItem
.
setLeftBarButton
(
leftBarButtonItem
,
animated
:
false
)
// let leftBarButtonItem: UIBarButtonItem = UIBarButtonItem(customView: backButton)
// NSLayoutConstraint.activate([(leftBarButtonItem.customView!.widthAnchor.constraint(equalToConstant: 18)),(leftBarButtonItem.customView!.heightAnchor.constraint(equalToConstant: 18))])
// self.navigationItem.setLeftBarButton(leftBarButtonItem, animated: false)
self
.
navigationItem
.
setHidesBackButton
(
true
,
animated
:
false
)
//your custom view for back image with custom size
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
40
,
height
:
40
))
let
imageView
=
UIImageView
(
frame
:
CGRect
(
x
:
10
,
y
:
10
,
width
:
18
,
height
:
18
))
if
let
imgBackArrow
=
UIImage
(
named
:
icon
,
in
:
Bundle
(
for
:
MyEmptyClass
.
self
),
compatibleWith
:
nil
)
{
imageView
.
image
=
imgBackArrow
}
view
.
addSubview
(
imageView
)
let
backTap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
moveToBack(_:)
)
)
view
.
addGestureRecognizer
(
backTap
)
let
leftBarButtonItem
=
UIBarButtonItem
(
customView
:
view
)
self
.
navigationItem
.
leftBarButtonItem
=
leftBarButtonItem
self
.
navigationItem
.
title
=
""
// Add backgroundColor
...
...
Please
register
or
login
to post a comment