ios - UITableCell AccessoryView: Setting accessoryView equal to UIImageView infinite loop -
edit: have figured out answer on own here else needs it: uiimageviews cannot shared different instantiation of each uiimageview required each visible cell. know.
i have custom table has 2 types of cells. 1 cell set toggle between normal accessory of type checkmark. cell set have custom image accessory type. when selected accessory image changes opposite type, showing "invited" or "invite" message.
i've narrowed down code @ fault following, found within tableview:cellforrowatindexpath delegate method.
if(indexpath.section == 0){ cell = [tableview dequeuereusablecellwithidentifier:self.directcellid]; cellvalue = [self.contactsusingapp objectatindex:indexpath.row]; cell.imageview.image = [self getcontactimage:indexpath.row]; //vvvvvvvvvvvvvvvvv section @ fault vvvvvvvvvvvvvvvvv if([self.selectedcontactsusingapp containsobject:indexpath]) cell.accessoryview = self.invitedstatus; else cell.accessoryview = self.notinvitedstatus; //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } if comment out section no longer have runaway memory usage (the simulator showed me there sort of constant allocation going on, got passed 1.29gb after starting 40mb) but, obviously, images no longer show.
if matters uiimageviews initialized follows:
uiimage *invite = [self imagewithimage:[uiimage imagenamed: @"invite_btn.png"] scaledtosize:cgsizemake(40, 20)]; uiimage *invited = [self imagewithimage:[uiimage imagenamed: @"invited_btn.png"] scaledtosize:cgsizemake(40, 20)]; self.notinvitedstatus = [[uiimageview alloc]initwithimage:invite]; self.invitedstatus = [[uiimageview alloc]initwithimage:invited]; (imagewithimage:scale function returns resized image appropriate scale accounting retina found here: the simplest way resize uiimage?)
the same freezing happens when select 1 of cells because tableview:didselectrowatindexpath method works same toggling logic initialization method.
help?
i have figured out answer on own here else needs it: uiimageviews cannot shared different instantiation of each uiimageview required each visible cell. know.
Comments
Post a Comment