UIView rounded corner is not drawn when its Trailing

Hi,

Any view when it was positioned on the screen using its Leading & Trailing constraints, then the UIBezierPath fails to draw its Right Corners. The same code works if I position the view without using Leading & Trailing constraints.


Please find the screenshot and the code attached for your reference. I almost tried all the options of drawing corners, but its of no luck.

Sample code: https://github.com/symadept/iOS-Samples/tree/master/RoundedCornerIssue


Any help is highly appreciable.


Regards

Mustafa

Seems to work with Xcode 7 Beta 6. Both buttons are drawn similarly (I can't see your screenshot so can't compare to it). Have you checked the button frames are correct when viewDidLayoutSubviews is called?

Did you tried the following code:


This code is for iPhone 6+, you have set the width depending on the device.


trailingButton?.layer.cornerRadius = 8
trailingButton?.frame = CGRectMake(20, 0, 380, 20)
self.view.addSubview(trailingButton!)
middleButton?.layer.cornerRadius = 8
 middleButton?.frame = CGRectMake(20, 0, 380, 20)
 self.view.addSubview(middleButton!)



This might be helpful.

UIView rounded corner is not drawn when its Trailing
 
 
Q