I did a bit of research, and I see, there is no easy way to make only top right and top left corners of the UIView round, right?
ps. This code makes all 4 corners round which is smth. I don't want.
#import <QuartzCore/QuartzCore.h>
self.layer.cornerRadius = 5;
self.layer.masksToBounds = YES;
You can do it with this snippet:
EDIT
Sorry, I forgot this
PS: as I said in the comment, if you use things like this when displaying
UITableViewCell
cells, I've found that it's always a better choice to use background images because this kind of drawing stuff always affects performance.I tried extensions for the UIView once and it did not work for me because it have caused problems when drawing a cell
I got a better and easier solution now in 2 steps that worked perfectly good :)
1) One line of code (Swift 2.0) - it wounds all 4 corners of a view:
2) and one addition in storyboard you add 1 view with regular corners where you need no round corners and adjust constraints as you need : note that small regular corner View should be behind the main view. This is how it looks in storyboard
Here you can see constraints needed for the small view