iphone - Make specific corners of UIView round -
i did bit of research, , see, there no easy way make only top right , top left corners of uiview round, right?
ps. code makes 4 corners round smth. don't want.
#import <quartzcore/quartzcore.h> self.layer.cornerradius = 5; self.layer.maskstobounds = yes;
you can snippet:
// set top right & left corners [self setmaskto:yourview byroundingcorners:uirectcornertopleft|uirectcornertopright];
edit
sorry, forgot this
- (void)setmaskto:(uiview*)view byroundingcorners:(uirectcorner)corners { uibezierpath *rounded = [uibezierpath bezierpathwithroundedrect:view.bounds byroundingcorners:corners cornerradii:cgsizemake(8.0, 8.0)]; cashapelayer *shape = [[cashapelayer alloc] init]; [shape setpath:rounded.cgpath]; view.layer.mask = shape; }
ps: said in comment, if use things when displaying uitableviewcell
cells, i've found it's better choice use background images because kind of drawing stuff affects performance.
Comments
Post a Comment