In Paintcode 2, I have a circle inside a frame inside a canvas.
The constraints on the circle are set like this:
To get the circle to size up and not become an ellipse, I have to
- Know the expected aspect ratio
- Code it in Objective-C myself
Is there any way around this type of code?
-(void)drawRect:(CGRect)rect {
if (rect.size.width > rect.size.height) {
rect.origin.x = (rect.size.width - rect.size.height) * .5f;
rect.size.width = rect.size.height;
} else {
rect.origin.y = (rect.size.height - rect.size.width) * .5f;
rect.size.height = rect.size.width;
}
NSLog(@"Frame=%@", NSStringFromCGRect(rect));
[CircleDraw drawCircleWithFrame:rect];
}