ios - UIButton not working in UITableview -
have uitableviewcell
--> inside have 4 different uiview , 3 of views has uibuttons. want make uibutton
clickable. first time buttons clickable when go next screen , come back, buttons don't work. please let me know how implement this? thanks!
phmytripview *tripsview=[[phmytripview alloc] initwithframe:cgrectmake(10, 5, self.frame.size.width-20, cell.frame.size.height)];
tripsview.onbaggageclick = ^{ [weakself handlebaggagepurchasetapped]; }; if ([data count]>0) { [tripsview filltripdata:[data firstobject]]; [tripsview showancillaries:self.predictivemanager.upcomingcdairbookinginfo]; } [cell bringsubviewtofront:tripsview.bagsbutton]; [cell.viewplaceholder addsubview:tripsview];
this happens because cells reusable , if go screen button may kinda mess round different cell in ui or functionally.
the way solve add tag. can define cell.tag = indexpath.row * 10 or so.
then when draw button, check condition, if cell.tag == ?, add button.
Comments
Post a Comment