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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:51:47+00:00 2026-05-26T21:51:47+00:00

I am loading multiple MKPolylines as overlays onto an MKMapView . I would like

  • 0

I am loading multiple MKPolylines as overlays onto an MKMapView. I would like to be able to distinguish these some how so change things like color, line width, etc.

But, when viewForOverlay: gets called, it sees all my MKPolylines the same, which doesn’t allow me to change any of them.

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay {

    if ([overlay isKindOfClass:[MKPolyline class]]) {
        MKPolylineView *aView = [[[MKPolylineView alloc] initWithPolyline:(MKPolyline*)overlay] autorelease];
        aView.strokeColor = [[UIColor blueColor] colorWithAlphaComponent:0.7];
        MKZoomScale currentZoomScale = (CGFloat)(mapView.bounds.size.width / mapView.visibleMapRect.size.width);
        aView.lineWidth = MKRoadWidthAtZoomScale(currentZoomScale);

        return aView;
    }

    // Want to color my next overlay red

    return  nil;
}

How can I do this? Could I somehow attach tag to each MKPolyline? Or, another, better way 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-05-26T21:51:48+00:00Added an answer on May 26, 2026 at 9:51 pm

    MKPolyline inherits from MKShape which has a settable title (and subtitle) property which you can use to tell them apart.

    This answer has an example of how to use it with MKPolygon objects.

    If title and subtitle are not sufficient for your requirements, then you can subclass as Mundi commented.

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

Sidebar

Related Questions

I am loading a Texture2D that contains multiple sprite textures. I would like to
I am loading multiple images into a class instance and I would like to
I have a scrollview which has multiple webviews, these webviews are loading some pages.
I have multiple user controls loading asynchronously on my page, using pagemethods. Some dropdownlists
So I am loading multiple images onto multiple canvases basically (one image per canvas/ctx
What is the best way to design a SSIS package? I'm loading multiple dimensions
Some loading routines in my program takes to long to complete. I want a
After loading a reference to an assembly with something like: import clr clr.AddRferenceToFileAndPath(r'C:\foo.dll') How
After loading dynamic content to a DIV, I'd like to add a Close option,
Loading multiple child forms from a loop into a MDI parent form. They are

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.