i have simple + button on right side add rows tableview, button not appearing. how implement it
let addbutton = uibutton() addbutton.settitle("+", forstate: .normal) let addview = uibarbuttonitem(customview: addbutton) self.navigationitem.rightbarbuttonitem = addview addbutton.addtarget(self, action: #selector(self.addrow), forcontrolevents: uicontrolevents.touchupinside)
note, use same exact implementation hamburger button appear. working hamburger button implementation
let navicon = uibutton(type: uibuttontype.system) navicon.setimage(defaultmenuimage(), forstate: uicontrolstate.normal) navicon.frame = cgrectmake(0, 0, 30, 30) let menu = uibarbuttonitem(customview: navicon) self.navigationitem.leftbarbuttonitem = menu self.view.addgesturerecognizer(self.revealviewcontroller().pangesturerecognizer()) navicon.addtarget(self.revealviewcontroller(), action: #selector(swrevealviewcontroller.revealtoggle(_:)), forcontrolevents: .touchupinside)
why happening?
try:
let addbutton = uibutton(type: .custom) addbutton.frame = cgrectmake(0, 0, 44, 44)
Comments
Post a Comment