ios - Change UITableView custom header view's button image not working -


i created uiview using nib file. , set table view header view. in view have button. tried change button's image, nothing changes.

- (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section {     if (section == 0) {         healthplanheaderview *view = (healthplanheaderview *)[[[nsbundle mainbundle] loadnibnamed:nsstringfromclass([healthplanheaderview class]) owner:self options:nil] firstobject];         [view.addbutton addtarget:self action:@selector(editfood) forcontrolevents:uicontroleventtouchupinside];         self.healthplanheaderview = view;         return view;     }else {         return nil;     } }  - (void)editfood {     self.healthediting = !self.healthediting;     uiimage *image = self.healthediting ? [uiimage imagenamed:@"finish"] : [uiimage imagenamed:@"edit-button"];     [self.healthplanheaderview.addbutton setimage:image forstate:uicontrolstatenormal]; } 

i noticed button image did set, button won't show newly set image, remains unchanged.

maybe, need invoke tableview's reloaddata refresh it.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -