ios - "argument contains uninitialised data" when setting frame -


i new ios development , handling memory leaks. in project while analysing project got memory leaks. not fix below logic error @ below code.

cgrect labelframe;   if ([questonmod.questiontype isequaltostring:@"type1"]) {     nooflinesint=questonmod.questiontext.length/20;      if (nooflinesint<1)     {         nooflinesint=nooflinesint+2;     }     else     {         nooflinesint=nooflinesint+1;     }      labelframe= cgrectmake(5, 0, cell.frame.size.width-10, nooflinesint*18);   } else if([questonmod.questiontype isequaltostring:@"type2"]) {      nooflinesint=questonmod.questiontext.length/10;      if (nooflinesint<1)     {         nooflinesint=nooflinesint+2;     }     else     {         nooflinesint=nooflinesint+1;     }     labelframe= cgrectmake(5,0,cell.frame.size.width-155,nooflinesint*16);  }   cell.questionlabel.frame=labelframe; //at line got below error. 

i getting "passed-by-value struct argument contains uninitialised data(e.g., via field chain:'origin.x')" error description.

please suggest how can fix above issue..

thanks in advance..

initialize cgrect labelframe; this

cgrect labelframe = cgrectmake(0, 0, 0, 0); 

or

cgrect labelframe = cgrectzero; 

or adding else condition below solve problem

if ([questonmod.questiontype isequaltostring:@"type1"]) {     nooflinesint=questonmod.questiontext.length/20;      if (nooflinesint<1)     {         nooflinesint=nooflinesint+2;     }     else     {         nooflinesint=nooflinesint+1;     }      labelframe= cgrectmake(5, 0, cell.frame.size.width-10, nooflinesint*18);   } else if([questonmod.questiontype isequaltostring:@"type2"]) {      nooflinesint=questonmod.questiontext.length/10;      if (nooflinesint<1)     {         nooflinesint=nooflinesint+2;     }     else     {         nooflinesint=nooflinesint+1;     }     labelframe= cgrectmake(5,0,cell.frame.size.width-155,nooflinesint*16);  } else{   labelframe = cgrectmake(0, 0, 0, 0); }   cell.questionlabel.frame=labelframe;  

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -