i've built simple tableview accessory view each row. i've added uisearchcontroller. everytime search object , select accessory view object accessory view image not update.
- (void)tableview:(uitableview *)tableview accessorybuttontappedforrowwithindexpath:(nsindexpath *)indexpath { uibutton *button = (uibutton *)cell.accessoryview; uiimage *image; image = [uiimage imagenamed:@"unchecked.png"]; [button setbackgroundimage:image forstate:uicontrolstatenormal]; } after cancel search checkmarks visible (accessory view) rows searched for.
you need use cell of resulttableview of uisearchcontroller, try this:
- (void)tableview:(uitableview *)tableview accessorybuttontappedforrowwithindexpath:(nsindexpath *)indexpath { if(tableview == self.searchdisplaycontroller.searchresultstableview) cell=[self.searchdisplaycontroller.searchresultstableview cellforrowatindexpath:indexpath]; else cell=[self.tableview cellforrowatindexpath:indexpath]; uibutton *button = (uibutton *)cell.accessoryview; uiimage *image; image = [uiimage imagenamed:@"unchecked.png"]; [button setbackgroundimage:image forstate:uicontrolstatenormal]; }
Comments
Post a Comment