0

For some reason, iOS 6 draws a standard RoundedRect differently. The old rounded button (top) has black as the edge when selected or highlighted. The same code draws the button with white as the edge in iOS 6.0 (below). I can't find a way to change the color back to Black as in iOS 5. Any idea?

The code is simply

_loadButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[_loadButton setFrame:CGRectMake(200, 130, 115, 40)];
[_loadButton setTitle:@"Load Game" forState:UIControlStateNormal];

enter image description here

enter image description here

4

1 回答 1

3

Try this:

[button.layer setBorderColor:(__bridge CGColorRef)([UIColor blackColor])];

For rounded edges:

button.layer.cornerRadius = 8;

You can also add this:

[button.layer setMasksToBounds:YES];
[button.layer setBorderWidth:1.0f];
于 2012-09-21T14:26:01.803 回答