How to get back the UIButton border in iOS 7?

前端 未结 3 1899
猫巷女王i
猫巷女王i 2020-12-31 17:12

I built an old project in iOS SDK 6.1 in Xcode 5. However, the UIbutton is borderless when the app runs on an iPhone running iOS 7. I have checked the .xib is

3条回答
  •  借酒劲吻你
    2020-12-31 17:33

    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]];
    }
    

提交回复
热议问题