In the iPhone, I can use
view.layer.cornerRadius = 10;
to make the corner round, but I don't want the four corner is rounded, I just want to bottom two round. How can I do so? Thanks.
In the iPhone, I can use
view.layer.cornerRadius = 10;
to make the corner round, but I don't want the four corner is rounded, I just want to bottom two round. How can I do so? Thanks.
An easy but a bit ugly solution is to use two layers partially on top of each other so that one of them "hide" the top round corners.
Update found this question Round two corners in UIView which has much more proper and better solutions.
Here's the solution that I used for a custom table view cell:
Assuming a cell is height 44.
Add a subview with height 66, call it roundedCornerContainer
Within the subview, add cell's content.
Add an IBOutlet to the roundedCornerContainer
When you configure the cell:
#import <QuartzCore/QuartzCore.h>
roundedCornerContainer.layer.cornerRadius = 8;
roundedCornerContainer.layer.masksToBounds = YES;
Don't forget that you need to set your cell's prototype to clip subviews to prevent the roundedCornerContainer from sticking out.
The end result is that the top left and top right corner of the grouped UITableView cell get rounded, while the bottom left and right appear as 90 degree (the bottom rounded corners are clipped by the cell.
If you need to repeat this trick with the bottom grouped cell, simply change the origin of the roundedCornerContainer
within the cell's prototype, shifting it's origin 22 points up.