Browse Source

navigation bar fixed

pull/1/head
gme_2 6 years ago
parent
commit
c053fb2818
  1. 9
      GMERemittance/AppDelegate.swift
  2. 31
      GMERemittance/Extension/UIViewControllerExtension.swift
  3. 13
      GMERemittance/Home/HomeViewController.swift
  4. 5
      GMERemittance/Module/Login/User Interface/View/LoginViewController.swift
  5. 17
      GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift

9
GMERemittance/AppDelegate.swift

@ -56,7 +56,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
let uuid = UUID().uuidString let uuid = UUID().uuidString
UserDefaults.standard.set(uuid, forKey: AppConstants.uuid) UserDefaults.standard.set(uuid, forKey: AppConstants.uuid)
} }
setupNavBar()
setEntryPoint() setEntryPoint()
// if (UserDefaults.standard.object(forKey: "com.gmeremit.loginStatus")) != nil{ // if (UserDefaults.standard.object(forKey: "com.gmeremit.loginStatus")) != nil{
@ -66,6 +66,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
return true return true
} }
private func setupNavBar() {
let appearance = UINavigationBar.appearance()
appearance.backIndicatorImage = #imageLiteral(resourceName: "backIconBlack")
appearance.backIndicatorTransitionMaskImage = #imageLiteral(resourceName: "backIconBlack")
appearance.tintColor = UIColor.black
}
private func setEntryPoint() { private func setEntryPoint() {
let _default = UserDefaults.standard let _default = UserDefaults.standard
if let loginStatus = _default.string(forKey: UserKeys.accessCode) { if let loginStatus = _default.string(forKey: UserKeys.accessCode) {

31
GMERemittance/Extension/UIViewControllerExtension.swift

@ -13,6 +13,24 @@ import MBProgressHUD
// MARK: Alerts // MARK: Alerts
extension UIViewController {
func setupPicturedNavBar(sideMenuAction: Selector? = nil) {
self.navigationController?.navigationBar.isTranslucent = false
if let selector = sideMenuAction {
let leftButton = UIBarButtonItem(image: UIImage(named: "ic_hamburger"), style: .plain, target: self, action: selector)
self.navigationItem.leftBarButtonItem = leftButton
self.navigationItem.leftBarButtonItem?.tintColor = UIColor.white
}
self.navigationController?.navigationBar.tintColor = .white
self.navigationController?.navigationBar.barTintColor = UIColor(hex:0xec1c24)
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 125, height: 30))
imageView.contentMode = .scaleAspectFit
let image = UIImage(named: "ic_gme_new")
imageView.image = image
self.navigationItem.titleView = imageView
}
}
extension UIViewController { extension UIViewController {
func confirmationAlert(title: String, message: String, confirmTitle: String, style: UIAlertActionStyle = .destructive, confirmAction: @escaping () -> Void) { func confirmationAlert(title: String, message: String, confirmTitle: String, style: UIAlertActionStyle = .destructive, confirmAction: @escaping () -> Void) {
@ -663,20 +681,7 @@ extension UIViewController {
} }
func setUpAnotherLoginListener(genericviewmodel: ModelExtension) { func setUpAnotherLoginListener(genericviewmodel: ModelExtension) {
// genericviewmodel.anotherLogin.bind { [weak self] in
// guard let context = self else {
// return
// }
// guard $0 != nil else {
// return
// }
// if $0! {
// context.view.endEditing(true)
// context.enableUserInteractions()
// context.logOutUser()
// }
// }
} }

13
GMERemittance/Home/HomeViewController.swift

@ -151,17 +151,8 @@ class HomeViewController: UIViewController, TableViewCellDelegate, FBSDKSharing
//--ALL NAV BAR FUNCTIONS HERE //--ALL NAV BAR FUNCTIONS HERE
func setNavBar() { func setNavBar() {
self.navigationController?.navigationBar.isTranslucent = false
let rightButton = UIBarButtonItem(image: UIImage(named: "ic_hamburger"), style: .plain, target: self, action: #selector(showSideMenu))
self.navigationItem.leftBarButtonItem = rightButton
self.navigationItem.leftBarButtonItem?.tintColor = UIColor.white
self.navigationController?.navigationBar.barTintColor = UIColor(hex:0xec1c24)
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 125, height: 30))
imageView.contentMode = .scaleAspectFit
let image = UIImage(named: "ic_gme_new")
imageView.image = image
self.navigationItem.titleView = imageView
let selector = #selector(self.showSideMenu)
self.setupPicturedNavBar(sideMenuAction: selector)
} }
@objc func showSideMenu() { @objc func showSideMenu() {

5
GMERemittance/Module/Login/User Interface/View/LoginViewController.swift

@ -31,7 +31,12 @@ class LoginViewController: UIViewController {
private func setup() { private func setup() {
// all setup should be done here // all setup should be done here
setupNavBar()
}
private func setupNavBar() {
self.navigationController?.isNavigationBarHidden = false
self.setupPicturedNavBar()
} }
} }

17
GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift

@ -52,6 +52,17 @@ class SplashScreenViewController: UIViewController {
self.setup() self.setup()
} }
override func viewWillAppear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationItem.title = ""
hideNavBar()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationItem.title = ""
}
// MARK: IBActions // MARK: IBActions
@IBAction func login(_ sender: UIButton) { @IBAction func login(_ sender: UIButton) {
@ -65,10 +76,14 @@ class SplashScreenViewController: UIViewController {
// MARK: Other Functions // MARK: Other Functions
private func hideNavBar() {
self.navigationController?.isNavigationBarHidden = true
}
private func setup() { private func setup() {
// all setup should be done here // all setup should be done here
hideNavBar()
setUpButtons() setUpButtons()
self.navigationController?.isNavigationBarHidden = true
imageViewDotLeft.image = UIImage(named: "dotSelected") imageViewDotLeft.image = UIImage(named: "dotSelected")
let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(_SplashScreenViewController.handleSwipes(_:))) let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(_SplashScreenViewController.handleSwipes(_:)))
let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(_SplashScreenViewController.handleSwipes(_:))) let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(_SplashScreenViewController.handleSwipes(_:)))

Loading…
Cancel
Save