swift - change uinavigation bar item position -


how can change uinavigation baritem position leftbarbuttonitem rightbarbuttonitem function

enter image description here

for need create custom barbuttonitem , set right side, need hide default backbarbutton, try thing this. add below code inside viewdidload.

self.navigationitem.hidesbackbutton = true let btnforward = uibutton(frame: cgrect(x: 0, y: 0, width: 25, height: 25)) btnforward.setimage(uiimage(named: "forward_arrow"), forstate: .normal) btnforward.addtarget(self, action: #selector(self.buttonaction(_:)), forcontrolevents: .touchupinside) let backitem = uibarbuttonitem(customview: btnforward)      self.navigationitem.rightbarbuttonitem = backitem 

after add action method inside viewcontroller

func buttonaction(sender: uibutton) {     self.navigationcontroller?.popviewcontrolleranimated(true) } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -