ios - Adding image in TableView Cell does not show -


i adding image in tableview cell not show. using if condition give image button not show.

here code button addding

    addbutton = [uibutton buttonwithtype:uibuttontypecustom];     addbutton.frame=cgrectmake(590,2,42,42);      [addbutton addtarget:self action:@selector(tab1action:) forcontrolevents:uicontroleventtouchupinside];     addbutton.tag=indexpath.row;       nsstring*test=thedata.status;      if ([test isequaltostring:@"1"]) {          test=@"already member of group";        }      else {          test=@"";            nslog(@"else working fine");             [addbutton setimage:[uiimage imagenamed:@"addbutton.png"] forstate:uicontrolstatenormal];      }     addbutton.clipstobounds=yes;     [[cell contentview] addsubview:addbutton];             cell.textlabel.font=[uifont fontwithname:@"helvetica" size:16];     cell.textlabel.text=[nsstring stringwithformat:@"%@: %@",thedata.grouptitle,test];      return cell; 

you don't need add cell's contentview. this..

   [cell addsubview:addbutton];  

Comments