Posted By

mlecho on 07/20/12


Tagged

UIView


Versions (?)

equal horizontal distribution


 / Published in: Objective C
 

  1. float x,y;
  2. float space = kSpacing;
  3. float width = rect.size.width;
  4. int ct = [_images count];
  5. float totalspace = (ct-1)*space;
  6.  
  7. x= (width/2) - (totalspace/2);//find the starting CENTER of first point
  8. y = rect.size.height/2;
  9.  
  10. for (UIImage *img in _images) {
  11. CGSize sz = img.size;
  12. CGPoint pt = CGPointMake(x - sz.width/2, y - sz.height/2);
  13. NSLog(@"pt: %@",NSStringFromCGPoint(pt));
  14. [img drawAtPoint:pt];
  15. x+=space;
  16. }

Report this snippet  

You need to login to post a comment.