Domanda

I've got a normal UIButton on a view and when I launch the application in the IOS6 simulator I see a button with text on it. When I launch the same app under the IOS7 simulator all I see is the text with no button underneath.

It looks correct in XCode:

Inside XCode

But this is what I see in the IOS7 simulator: enter image description here

È stato utile?

Soluzione

That's the way iOS 7 system buttons look like.
If you want to simulate the iOS 6 look, change it to a custom button, set your own background, and do something like:

First add #import <QuartzCore/QuartzCore.h> framework to your .m file and use following code for your button.

button.layer.cornerRadius = 4;
button.clipToBounds = YES;
button.layer.borderColor = [UIColor {your color here}].CGColor;
button.layer.borderWidth = 1;

Altri suggerimenti

That's the new button style in iOS 7. What you see is normal. If your want to have a consistent style on iOS 6 & 7 you need to set the buttonType to Custom (I guess that now it's System) and choose a color etc.

This is the default look for button in iOS7. Just text - no background.

If you actually want to see an outline for a button you will have to add your own background image.

This is the difference between ios 6 & ios 7. You have to make custom if you want like ios 6.

If you want to like ios 6, then follow this code:

First add #import <QuartzCore/QuartzCore.h> framework to your .m file and use following code for your button.

// Set button background color as white color ...

[yourbutton.layer setBorderColor:[[UIColor ClearColor] CGColor]];
[yourbutton.layer setBorderWidth:0.0];
[yourbutton.layer setCornerRadius:10.0f];
[yourbutton.layer setMasksToBounds:YES];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top