Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8391399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:15:03+00:00 2026-06-09T19:15:03+00:00

Below is a flag that I would like to draw in core graphic. What

  • 0

Below is a flag that I would like to draw in core graphic.

enter image description here

What I do is :

Flag.m
- (void)drawRect:(CGRect)rect {

    CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSetLineWidth(context, 1.0);

    CGContextMoveToPoint    (context, 20, 10);
    CGContextAddLineToPoint (context, 50, 10);
    CGContextAddLineToPoint (context, 50, 90);
    CGContextAddLineToPoint (context, 45, 90);
    CGContextAddLineToPoint (context, 45, 95);
    CGContextAddLineToPoint (context, 40, 92);
    CGContextAddLineToPoint (context, 35, 90);
    CGContextAddLineToPoint (context, 30, 92);  
    CGContextAddLineToPoint (context, 25, 95);
    CGContextAddLineToPoint (context, 25, 90); 
    CGContextAddLineToPoint (context, 20, 90);  
    CGContextAddLineToPoint (context, 20, 10);    

    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
    CGContextFillPath(context);

}

What I am ending up is below

enter image description here

My question :

How can I add the shadow so that my flag seems to be folded and curled at its tails (like the red flag above)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:15:04+00:00Added an answer on June 9, 2026 at 7:15 pm

    This is a relatively simplified version. I commented out a few of the points to build it in two parts. The tail part is drawn first. Then, the main ribbon is drawn above. A nice shadow effect can be drawn with a [UIColor colorWithWhite:0.0 alpha:0.4]

    If you want to get a bit fancier, you would draw the bottom few points of the main area as another rectangle with a gradient. Make sure to turn the shadow off before drawing that last rect.

    /*CGContextMoveToPoint    (context, 20, 10);
    CGContextAddLineToPoint (context, 50, 10);*/
    CGContextMoveToPoint    (context, 48, 85);
    CGContextAddLineToPoint (context, 48, 90);
    CGContextAddLineToPoint (context, 45, 90);
    CGContextAddLineToPoint (context, 45, 95);
    CGContextAddLineToPoint (context, 40, 92);
    CGContextAddLineToPoint (context, 35, 90);
    CGContextAddLineToPoint (context, 30, 92);
    CGContextAddLineToPoint (context, 25, 95);
    CGContextAddLineToPoint (context, 25, 90);
    CGContextAddLineToPoint (context, 22, 90);
    CGContextAddLineToPoint (context, 22, 85);
    //CGContextAddLineToPoint (context, 20, 10);
    CGContextSetShadowWithColor(context, CGSizeMake(0, 5.), 3., [UIColor colorWithWhite:0 alpha:.4].CGColor);
    CGContextSetFillColorWithColor(context, [UIColor colorWithWhite:.95 alpha:1].CGColor);
    CGContextFillPath(context);
    CGContextSetShadowWithColor(context, CGSizeMake(0, 2.), 1.5, [UIColor colorWithWhite:0 alpha:.3].CGColor);
    CGContextMoveToPoint    (context, 20, 88);
    CGContextAddLineToPoint (context, 20, 10);
    CGContextAddLineToPoint (context, 50, 10);
    CGContextAddLineToPoint (context, 50, 88);
    CGContextFillPath(context);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is the code from internalRegister method of GCMRegistrar class static void internalRegister(Context context,
Below is the code from a plugin I use for sitemaps. I would like
I'm trying to produce a page that would function a bit like a digital
I would like to create a notification that clears automatically when the user presses
Below is code to an inherited ComboBox. The issue is that the ComboBox is
Below is how my screen look like ********************************************************* * Welcome to Mysite * *
I have the below code that links and runs fine in 32bit mode -
In conjunction a previous question of mine, I would like to know exactly what
Basically what i would like to do is have a button which is only
I'm trying to add a UIView, in particular a UIImageVIew, after (that is, below,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.