I just updated my Xcode ver from 7.3 to 8.0 and some buttons borders disappeared.
The code looks fine, so I really don't know what happened to the layers.
btw - in some other controllers I can see the layers borders.
self.button.layer.borderColor = borderColor.CGColor;
self.button.layer.borderWidth = 2;
self.button.layer.cornerRadius = CGRectGetHeight(self.button.frame) / 2;
The reason is that XCode 8 introduces a new way to zoom in Storyboards.
Before XCode 8, in the view controller life cycle,
frames were not known in viewDidLoad (or in properties
didSet). You had to wait until viewDidLayoutSubviews (which is when Autolayout had finished applying the constraints to determine the frames of every subview in the main view.
bounds were accessible before that: they were just set to the size of the IBOutlet in the storyboard.
In XCode 8, things are different : due to their new zooming system, even the
boundsare not correct before ViewDidLayoutSubviews (they may exist but with dummy values like 1000 x 1000).
In conclusion :
bounds, then do so in viewDidLayoutSubviews, or use NSLayoutConstraints (their value is fixed and known from Autolayout).