ios - Is it possible to set text on single button of UITableViewCell in swift -
i have 1 uitableview having 2 buttons on cell.i want set text on button picker view , date picker.on selection of done button uipickerview can set text firstbutton. when selecting date uidatepicker secondbutton, firstbutton text gets changes.
var selectedindexpath = nsindexpath(forrow: 0, insection: 0) datatableview.reloadrowsatindexpaths([selectedindexpath], withrowanimation: .none)
here function on done button click:
@ibaction func pickerdonebuttonclicked(sender: anyobject) { let cell = datatableview.dequeuereusablecellwithidentifier("cell", forindexpath: selectedindexpath) as! datatableviewcell cell.frequencybutton .settitle(pickerdatasource[frequencypicker.selectedrowincomponent(0)], forstate: uicontrolstate.normal) datapicker.hidden = true pickertoolbar.hidden = true datapickerview.hidden = true datatableview.reloadrowsatindexpaths([selectedindexpath], withrowanimation: .none) }
i have reload tableview row on done button action.please suggest me better way this. in advance
set tags buttons according indexpath of cell , access buttons let tmpbutton = self.view.viewwithtag(yourbuttontag) as? uibutton
, dont think need reload whole tableview purpose. hope helps.
Comments
Post a Comment