Reputation:
I wish to create a table cell like the following image
How could this be done via storyboard? My initial plan was to use two different views/labels, And round the edges using layer.cornerRadius
but this rounds all edges of both views/labels.
Upvotes: 1
Views: 191
Reputation: 100503
Add the greenView inside cell's contentView and round it with cornerRadius
and inside it add the blackView without any rounding as the superview will do the job only make sure
greenView.clipsToBounds = true // can be set in IB
greenView.layer.cornerRadius = 7
You can also add these 2 views below each other and round top corners of the top and bottom ones of the bottom view with https://www.hackingwithswift.com/example-code/calayer/how-to-round-only-specific-corners-using-maskedcorners
Upvotes: 1
Reputation: 3187
Embed both views in a container UIView
and round the corners of the container.
containerView.clipsToBounds = true
containerView.layer.cornerRadius = 10
Upvotes: 0