Cocoa Touch: How To Change UIView's Border Color And Thickness?

后端 未结 14 1066
心在旅途
心在旅途 2020-11-30 16:56

I saw in the inspector that I can change the background color, but I\'d like to also change the border color and thickness, is this possible?

14条回答
  •  再見小時候
    2020-11-30 17:28

    You need to use view's layer to set border property. e.g:

    #import 
    ...
    view.layer.borderColor = [UIColor redColor].CGColor;
    view.layer.borderWidth = 3.0f;
    

    You also need to link with QuartzCore.framework to access this functionality.

提交回复
热议问题