// Set view position and size of the UIView myView * = [[the UIView the alloc] the initWithFrame: CGRectMake ( 15 , 300 , self.view.bounds.size.width- 30 , 46 is )]; // set the background color myView.backgroundColor = [ blackColor UIColor]; // draw the rounded corners rounded to set "|" is combined UIBezierPath maskPath * = [UIBezierPath bezierPathWithRoundedRect: myView.bounds byRoundingCorners: UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii: CGSizeMake ( 16 , 16 )]; CAShapeLayer * = maskLayer [[CAShapeLayer the alloc] the init]; // set the size maskLayer.frame =myView.bounds; // set the graphic appearance maskLayer.path = maskPath.CGPath; myView.layer.mask = maskLayer; // add [self.view addSubview: myView];