Create circle in iOS Objective C with and without fill

Solution:

In iOS you can create a circle using CGContextref. The below code is used for draw a circle in a view with 0 x axis,0 y axis,width 20 and height 20..



    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGRect rect = CGRectMake(00,20,20)
    CGContextClearRect(ctx, rect);
    CGContextSetLineWidth(ctx, 10);
     CGContextStrokeEllipseInRect(UIGraphicsGetCurrentContext(), rect);

If you want to fill the rectangle then add the below code 

        CGContextSetFillColorWithColor(ctx, color.CGColor);
        CGContextFillEllipseInRect(UIGraphicsGetCurrentContext(), rect);

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift