uitableview - ios Cutom tableview cell subview each other overlaping each other -


i have created 2 custom cells uilabel , uiimageview. if added space between them uiimageview cell overlaps uilabel cell. in addition, updating frame of uilabel cell not updating. not using autolayout. can 1 give me solution this?

enter image description here

 - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     determinecoatingcell *cell=[[nsbundle mainbundle] loadnibnamed:@"determinecoatingcell" owner:self options:nil][0];     float cellheight = [self tableview:tableview heightforrowatindexpath:indexpath];     nsdictionary *option =[arroptions objectatindex:indexpath.row];      if (is_ipad) {         // float yvalue=(cellheight/2)-10;         lbltable= [[uilabel alloc]initwithframe:cgrectmake(30, 5, 590, cellheight)];         lbltable.font=[uifont systemfontofsize:30];         lbltable.numberoflines=0;         lbltable.textcolor=[uicolor colorwithred:63.0/255.0f green:126.0/255.0f blue:199.0/255.0f alpha:1.0];         lbltable.textalignment=nstextalignmentleft;         } else {         // float yvalue=(cellheight/2)-5;         if (![option[@"coatingimage"] isequaltostring:@""]) {                 cell.imgview.tag = indexpath.row;             cell.imgview.userinteractionenabled = yes;              uitapgesturerecognizer *tapgesture=[[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(imgviewtapped:)];             tapgesture.numberoftapsrequired = 1;                           tapgesture.view.tag = indexpath.row;             tapgesture.cancelstouchesinview = no;             //  [tapgesture setvalue:[nsstring stringwithformat:@"%ld",indexpath.row] forkey:@"tag"];             [cell.imgview addgesturerecognizer:tapgesture];              nsstring *key = [[option valueforkey:@"coatingimage"] md5hash];             nsdata *data = [ftwcache objectforkey:key];             if (data) {                 uiimage *image = [uiimage imagewithdata:data];                 cell.imageview.image=image;              } else {                               [webimageoperations processimagedatawithurlstring:[option valueforkey:@"coatingimage"] andblock:^(nsdata *imagedata) {                      [ftwcache setobject:imagedata forkey:key];                     uiimage *image = [uiimage imagewithdata:imagedata];                     dispatch_async(dispatch_get_main_queue(), ^{                         cell.imageview.image=image;                     });                           }];             }         } else {              cgrect framelbl  = cgrectmake(0,0, cell.lbltitle.frame.size.width,cell.lbltitle.frame.size.height);              nslog(@"%@",nsstringfromcgrect(framelbl));             [cell.lbltitle setframe:framelbl];         }     }     cell.lbltitle.text=[nsstring stringwithformat:@"%@",[option valueforkey:@"answeroptiontext" ]];      cell.lbltitle.textcolor=[uicolor  colorwithred:63.0/255.0f green:126.0/255.0f blue:199.0/255.0f alpha:1.0];      nslog(@"lbltabletext %@",lbltable.text);      if(selectedpath.row == indexpath.row  && selectedpath.section == indexpath.section)     {         cell.backgroundcolor = [uicolor colorwithred:227.0/255.0f green:227.0/255.0f blue:227.0/255.0f alpha:1.0];;     } else {         cell.backgroundcolor = [uicolor clearcolor];     }      return cell; } 

if you're determined not use autolayout in table view, investigate table view delegate method -[id tableview:heightforrowatindexpath:]:

https://developer.apple.com/library/ios/documentation/uikit/reference/uitableviewdelegate_protocol/#//apple_ref/occ/intfm/uitableviewdelegate/tableview:heightforrowatindexpath:

you'll need identify row corresponds image view cell, , label cell, , return appropriate height.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -