How to get back the UIButton border in iOS 7?

最后都变了- 提交于 2019-11-30 09:06:00

you can create a category:

- (void)setRoundedBorder:(float) radius borderWidth:(float)borderWidth color:(UIColor*)color
{
    CALayer * l = [self layer];
    [l setMasksToBounds:YES];
    [l setCornerRadius:radius];
    // You can even add a border
    [l setBorderWidth:borderWidth];
    [l setBorderColor:[color CGColor]];
}

Try this

set border width of button by using QuartzCore Framework

#import <QuartzCore/QuartzCore.h>

button.layer.borderWidth=1.0f;
button.layer.borderColor=[[UIColor blackColor] CGColor];

If you don't want to introduce any of the iOS 7 changes changing the SDK is not enough. You shouldn't leave the Interface Builder "Opens in" property unchanged as well.

I leave mine in "Xcode 4.6" and everything looks as it should.

I think the only advantage you would take is with the new auto-layout.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!