How to create border in UIButton?

前端 未结 12 1513
天命终不由人
天命终不由人 2020-12-02 05:51

I use custom button in my app named \"addButton\" and I want to border it with white color how can i get the white color border around my custom button?

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 06:27

    You don't need to import QuartzCore.h now. Taking iOS 8 sdk and Xcode 6.1 in referrence.

    Directly use:

    [[myButton layer] setBorderWidth:2.0f];
    [[myButton layer] setBorderColor:[UIColor greenColor].CGColor];
    

提交回复
热议问题