I am working in Xcode 7 beta 3. I want to create a label with a rounded rectangle background. By default, I can create a background with my color of choice but I can't round the corners. I have tried creating an outlet for that label and then in viewDidLoad()
I wrote this code label.layer.cornerRadius = 10
. I didn't get any errors but it didn't change the label in the simulator. Does anyone know how to do this in Swift 2?
Ios – How to create a rounded rectangle label in Xcode 7 and Swift 2
iosrounded-cornersswiftuser interfacexcode
Related Topic
- Ios – How to round the corners of a button
- Android – drawable with rounded corners at the top only
- Xcode – How to download Xcode DMG or XIP file
- Swift – How to call Objective-C code from Swift
- IOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta
- Swift – How to make a button have a rounded border in Swift
- R – Prepared Statements For ODBC in VB.net
- Ios – Xcode 12, building for iOS Simulator, but linking in an object file built for iOS, for architecture ‘arm64’
Best Answer
The most simplest approach is to add this attribute to the label you want to have rounded corners.
And also enable Clip Subviews property as well.