ios - How to pass in screen from one TabBarItem to another TabBarItem? -
in picture above,
in tabbar selected 1. tabbar item -> c -> d ,
in tabbar selected 3. tabbar item in order of e -> d -> a
app remembers d screen on 1. tabbar item . want "a" screen open.
code below;
d viewcontroller :
@ibaction func gotomapbutton(_ sender: any) { if let navcontroller = self.tabbarcontroller?.viewcontrollers?[0] as? uinavigationcontroller{ if let mapcontroller = navcontroller.childviewcontrollers.first as? mapviewcontroller{ self.tabbarcontroller?.selectedindex = 0 mapcontroller.zoomtogeo(x: double(photoitemarrayselected[0].photolon!)!, y: double(photoitemarrayselected[0].photolat!)!,tesisadi: photoitemarrayselected[0].photoname) } } dismiss(animated: true, completion: nil) }
if want display screen belong tab 1, , screen looks mapviewcontroller:
if let navcontroller = self.tabbarcontroller?.viewcontrollers?[0] as? uinavigationcontroller{ if let mapcontroller = navcontroller.childviewcontrollers.first as? mapviewcontroller{ self.tabbarcontroller?.selectedindex = 0 mapcontroller.zoomtogeo(x: double(photoitemarrayselected[0].photolon!)!, y: double(photoitemarrayselected[0].photolat!)!,tesisadi: photoitemarrayselected[0].photoname) //add line , check if works or not. navcontroller.poptoviewcontroller(mapcontroller, animated: true) } }
Comments
Post a Comment