mikeMTOL / UIBarButtonItem-Badge

UIBarButtonItem+Badge
945 stars 167 forks source link

badgevalue disappears if I change viewcontroller using pushViewController #32

Open tattva20 opened 7 years ago

tattva20 commented 7 years ago

For some strange reason if I change from screen A to screen B using a slidemenu with the pushViewController instruction the badgeValue disappears, but if I turn off animations it stays there.

This is the method I'm using.

func openViewControllerBasedOnIdentifier(_ strIdentifier:String){ let destViewController : UIViewController = self.storyboard!.instantiateViewController(withIdentifier: strIdentifier)

let topViewController : UIViewController = self.navigationController!.topViewController!

if (topViewController.restorationIdentifier! == destViewController.restorationIdentifier!){
    print("Same VC")
} else {
    var numeroProductos = String(Carrito.numProd)

    self.navigationController!.pushViewController(destViewController, animated: true)

  }
}

If instead of using .pushViewController I perform a normal segue this doesn't happen, in either case I load the badgeValue again on viewDidLoad. Any ideas? I'm using swift 3.0

ewavestech commented 7 years ago

Same Problem to me also