Is it possible to set rounded corners on an UIView
's layer and override -drawRect:
at the same time? Currently the -drawRect:
call seems to override the layer's rounded corners and make them appear angular again, even if the -drawRect:
just contains a call to the super's -drawRect:
.
self.opaque = NO
didn't work for me. Setting self.layer.masksToBounds = YES
did work, however (tested on iOS 4.3):
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if( self )
{
self.layer.cornerRadius = 6.0f;
self.layer.masksToBounds = YES;
}
return self;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With