objective c - Return 2 variable in -(CGFloat) -


i want return 2 arguments in method -(cgfloat). try many way can't. here code. want return both of them "heightspace" , "widthspace".

-(cgfloat) spacebetweenledcenterwhennumberledisknown: (int) n andm: (int) m {     cgfloat heightspace = (self.view.bounds.size.height - 2 * _heightmargin) / (n - 1);     cgfloat widthspace = (self.view.bounds.size.width - 2 * _widthemargin) / (m - 1);      return [self spacebetweenledcenterwhennumberledisknown:heightspace andm:widthspace]; } 

i have solve problems cgsize. here final code. thank zaph.

-(cgsize) coutingspacebetweenledinheight: (int) height andwidth: (int) width {  cgfloat heightspace = (self.view.bounds.size.height - 2 * _heightmargin) / (height - 1);  cgfloat widthspace = (self.view.bounds.size.width - 2 * _widthmargin) / (width - 1);  //typedef struct cgsize cgsize;  return cgsizemake(heightspace, widthspace);} 

return cgsize, contains 2 cgfloats named width , height.

the caller can obtain 2 values.

struct cgsize { cgfloat width; cgfloat height; }; typedef struct cgsize cgsize; 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

mysql - FireDac error 314 - but DLLs are in program directory -