Custom table view cell with rounded edges

Oliver Ferris

I wish to create a table cell like the following image

enter image description here

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.

Sh_Khan

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related