Pregunta

I have the following code to show a simple button:

button = UIButton.buttonWithType(UIButtonTypeRoundedRect)
button.center = CGPointZero
button.frame = [[container.width/2-button.frame.size.width/2,150], [280,50]]
button.setTitle("Categorize New Project", forState: UIControlStateNormal)
button.addTarget(self, 
                 action: "moveToChildView:",
                 forControlEvents: UIControlEventTouchUpInside)

When I run this app in simulator iPhone retina (3.5 inch) with 6.1 it looks like this:

enter image description here

However, when I run it in simulator iPhone retina with 7.0 it looks like this:

enter image description here

Does this code need to change to work well with 7.0?

¿Fue útil?

Solución

As of iOS 7 the default rounded rectangle button looks like this. See the UI transition guide. I suggest using custom buttons to prevent such discrepancies between versions.

Otros consejos

As Alexander said it is new look of iOS7 and he also suggest to use custom buttons, which is good advice,
But here there is one another way to solve this problem which will give you bellow output enter image description here

Using this code

self.myButton.layer.cornerRadius = 10;
self.myButton.backgroundColor = [UIColor whiteColor];
self.myButton.layer.borderWidth = 1.0f;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top