Skip to content

Instantly share code, notes, and snippets.

@oliverbarreto
Created September 15, 2013 20:38
Show Gist options
  • Save oliverbarreto/6574148 to your computer and use it in GitHub Desktop.
Save oliverbarreto/6574148 to your computer and use it in GitHub Desktop.
Objective-C RoundedView:toDiameter:
-(void)setRoundedView:(UIImageView *)roundedView toDiameter:(float)newSize;
{
CGPoint saveCenter = roundedView.center;
CGRect newFrame = CGRectMake(roundedView.frame.origin.x, roundedView.frame.origin.y, newSize, newSize);
roundedView.frame = newFrame;
roundedView.layer.cornerRadius = newSize / 2.0;
roundedView.center = saveCenter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment