Created
September 15, 2013 20:38
-
-
Save oliverbarreto/6574148 to your computer and use it in GitHub Desktop.
Objective-C RoundedView:toDiameter:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(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