equal horizontal distribution


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.