uibezierpath - Rounded bottom edge of UIView -


in app have subclassed uinavigationbar , titleview i'm setting(in view controller) custom uiview

[self.playbutton setbackgroundcolor:[uicolor yellowcolor]]; [self.navigationitem settitleview:self.playbutton]; 

the bottom edge of view (playbutton) should curved. not corners, bot whole bottom edge.to achieve effect i'm using code:

cashapelayer *masklayer = [cashapelayer layer]; uibezierpath *path = [[uibezierpath alloc] init];  [path addcurvetopoint:cgpointmake(self.playbutton.frame.size.width, self.playbutton.frame.size.height)  controlpoint1:cgpointmake(0, self.playbutton.frame.size.height) controlpoint2:cgpointmake(self.playbutton.frame.size.width, 60)]; masklayer.path = path.cgpath; self.playbutton.layer.mask = masklayer; 

but after code uiview (playbutton) dissapeared! proper way apply curved bottom edge of uiview?

it should looks this: http://i.imgur.com/51uiqse.png

solution:

-(void)roundcorners:(uirectcorner)corner radius:(float)radius {        _cornerradius = radius;     _corner = corner;     [self setneedsdisplay]; }  - (void)drawrect:(cgrect)rect {     // drawing code     [super drawrect:rect];      uibezierpath *maskpath = [uibezierpath bezierpathwithroundedrect:self.bounds byroundingcorners:_corner cornerradii:cgsizemake(_cornerradius, _cornerradius)];      cashapelayer *masklayer = [cashapelayer layer];     masklayer.frame = self.bounds;     masklayer.path = maskpath.cgpath;      self.layer.mask = masklayer; } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -