1

How can we make a rounded rectangle frame programatically, as solved with

buyButton.layer.cornerRadius = 2;
buyButton.layer.borderWidth = 1;
buyButton.layer.borderColor = [UIColor blueColor].CGColor;

in iOS 7 round framed button

but resulting in a golden ratio corner such as the one introduced in the iOS 7 icon shape; new icon shape in iOS 7
iOS 6 and 7 icon difference?

3

2 Answers 2

5

If you want the same shape, just measure the image, eg with Photoshop and set the border radius proportional to the button's width. I did the measurement for you:

buyButton.layer.borderRadius = 0.315 * buyButton.frame.size.width;

I don't think it follows golden ratio thought. If it does, the ratio should be (1 - (sqrt(5) - 1)/2), which is 0.381..., which results in too rounded corners.

2
  • Very smart and simple, thank you! Will check on the original but basically, this is the formula for use with a desired ratio
    – Peter V
    Nov 18, 2013 at 21:22
  • I see, it's really golden ratio. Nov 18, 2013 at 21:36
1

There's more to the golden ratio in this template. It appears in the relative sizes of the circles in relation to each other and the width of the template. See http://www.phimatrix.com/product-design-golden-ratio/ for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.