I am trying to keep border for UIButton.If i use the following code it's working.
Case:1
[[_myButton layer] setBorderWidth:1.0f];
[[_myButton layer] setBorderColor:[UIColor lightGrayColor].CGColor];
But before when i wrote:
self.baseTypeButton.layer.borderWidth=2.0f;
self.myButton.layer.borderColor=[UIColor lightGrayColor];
XCode proposed me to do
Now my code changed,but i failed to set border in this case:
Case:2
_myButton.layer.borderWidth=2.0f;
_myButton.layer.borderColor=(__bridge CGColorRef _Nullable)([UIColor lightGrayColor]);
I am not using Auto-layout. Can anybody explain what is the difference between case-1 and case-2. Why case-2 wont work.