You can try the following:
#import <QuartzCore/QuartzCore.h>
and in your code, after creating your view, set the following:
self.layer.cornerRadius = x; self.layer.masksToBounds = TRUE;
This allows you to have rounded corners on your screen. And if you calculate the radius according to your idea, you should get the desired look.
- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor grayColor]; } return self; } - (void)drawRect:(CGRect)rect { CGContextRef context =UIGraphicsGetCurrentContext(); CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
I think it will be useful for you.
source share