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 8378815
In Process

The Archive Base Latest Questions

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

On iOS, if we do CGContextMoveToPoint(contextFoo, 0, 0); CGContextAddLineToPoint(contextFoo, x, y); CGContextAddLineToPoint(contextFoo, x2, y2);

  • 0

On iOS, if we do

CGContextMoveToPoint(contextFoo, 0, 0);
CGContextAddLineToPoint(contextFoo, x, y);
CGContextAddLineToPoint(contextFoo, x2, y2);
// ... and many more CGContextAddLineToPoint

then after this, if we do a CGContextStrokePath, we will get an outline, or if we CGContextFillPath, we get the “fill”, but we can’t do both, because after a stroke or a fill, the “current path” is gone. How can we both fill and stroke a path (such as wanting a yellow fill and orange outline)?

We can move the MoveTo and AddLine calls to a function, and call that function, do a fill, and call the function again, and do a stroke, but there are many x and y that makes passing all of them to the function quite troublesome. What might be some ways to do this?

  • 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-09T16:01:05+00:00Added an answer on June 9, 2026 at 4:01 pm
    CGContextDrawPath(context, kCGPathFillStroke);
    // to both Fill and Stroke your context
    // or kCGPathFill/kCGPathStroke to only fill/stroke
    

    you can save your Path btw (to reuse it for multiple things of same shape) using:

    CGPathBeginPath/MoveToPoint/AddLine/… very similar to CGContext/…

    For your example:

    [[UIColor yellowColor] setFill];                      
    [[UIColor orangeColor] setStroke];
    
    CGContextDrawPath(context, kCGPathFillStroke);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Many iOS developers have found the Cocoa Lumberjack Logging framework to fill a need
On iOS (or any mobile), after a successful login, how should I handle login
iOS uses programmatic styling for tab style icon images. I was wondering if this
iOS 5 library was automatically downloaded to my machine recently. Since this happened, when
In iOS 5, retain and release are not supported any more. Instead strong and
On iOS if I want to overlay two views and then blend from one
iOS apps will have a class that adopts the UIApplicationDelegate, called something like xxxAppDelegate.
iOS development guidelines suggest 44 points to be a minimum tappable area, comfortable for
iOS uses a variant of PNG processed a tool called pngcrush . If I
iOS includes setFinishedSelectedImage:withFinishedUnselectedImage: for customize the tab bar. I created a few textures with

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.