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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:13:28+00:00 2026-05-23T20:13:28+00:00

I have these methods into a MKOverlayView subclass, and I do not understand why

  • 0

I have these methods into a MKOverlayView subclass, and I do not understand why filling a path works, and why stroking that same path doesn’t work…

- (id) init {
    if (!(self = [super init])) return nil;

    self.opaque = NO;  // If not set, just black squares are drawn

    return self;
}

- (void) drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context {

    // CGRect rects[2] =  {[self rectForMapRect:mapRect],  [self rectForMapRect:self.country.boundingMapRect]};
    // CGContextClipToRects(context, rects, 2);

    CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 1.0);
    CGContextSetRGBFillColor(context, 1.0, 0.0, 1.0, 0.9);
    CGContextSetLineWidth(context, 1.0);

    for (MKPolygon* poly in self.polygons) {

        CGPoint origin = [self pointForMapPoint:poly.points[0]];            
        CGContextMoveToPoint(context, origin.x, origin.y);

        for (int i=1; i<poly.pointCount; i++) {
            CGPoint point = [self pointForMapPoint:poly.points[i]];
            CGContextAddLineToPoint(context, point.x, point.y);
        }

        //CGContextFillPath(context);
        CGContextStrokePath(context);
    }
}


-(BOOL)canDrawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale {
    return YES;
}
  • 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-05-23T20:13:28+00:00Added an answer on May 23, 2026 at 8:13 pm

    How zoomed out are you? It’s possible that your stroke is working; it just doesn’t show up because it’s too thin. Try setting your line width to 1.0 / zoomScale (or, more generally, desiredLineWidth * (1.0 / zoomScale)).

    (Disclaimer: I’ve never actually used MapKit, so you may need to use zoomScale as it is; based on my reading of the documentation, I would try 1.0 / zoomScale first.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that these methods are for pickling/unpickling and have no relation to the
I have certain PHP class methods that access external variables. These variables are not
I have these two methods on a class that differ only in one method
I have a class that contains two methods like these: public String getFoo(Int32 a)
I have a interface that defines some methods with attributes. These attributes need to
I have a class that currently has several methods that take integer parameters. These
I have a subclass of UIScrollView that overrides touchesBegan:withEvent: touchesMoved:withEvent: touchesEnded:withEvent: Overriding these three
I have a few methods that are practically the same except they have a
I have a class that has about 200+ methods, each of these methods makes
I have these 2 methods in the View class. the drawRect method always gets

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.