Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>U can change the color.But i do no about position.Create CustomAlert which inherits from Alert.In drawRect: u can specify color u want in CGContextSetRGBFillColor method. Here is implementation. @implementation CustomAlert</p> <pre><code>- (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } // Method which will draw the actual view - (void)drawRect:(CGRect)rect { CGContextRef context=UIGraphicsGetCurrentContext(); UIColor *color = [UIColor purpleColor]; const CGFloat *arr= CGColorGetComponents(color.CGColor); CGContextSetRGBStrokeColor(context,0, 0, 0, 1.0); CGContextSetRGBFillColor(context, arr[0], arr[1], arr[2], 0.85); CGContextSetLineWidth(context, 1.0); addRoundedRectToPath(context, rect); // Drawing final path CGContextDrawPath(context, kCGPathFill); } - (void)dealloc { [super dealloc]; } @end static void addRoundedRectToPath(CGContextRef context, CGRect rect){ CGFloat radius = 10; CGFloat minx = CGRectGetMinX(rect), midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect); CGFloat miny = CGRectGetMinY(rect), midy = CGRectGetMidY(rect), maxy = CGRectGetMaxY(rect); CGContextMoveToPoint(context, minx, midy); // Add an arc through 2 to 3 CGContextAddArcToPoint(context, minx, miny, midx, miny, radius); // Add an arc through 4 to 5 CGContextAddArcToPoint(context, maxx, miny, maxx, midy, radius); // Add an arc through 6 to 7 CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, radius); // Add an arc through 8 to 9 CGContextAddArcToPoint(context, minx, maxy, minx, midy, radius); CGContextClosePath(context); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload