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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:52:30+00:00 2026-06-14T12:52:30+00:00

I must be missing something here. I’ve created counter after counter and they all

  • 0

I must be missing something here. I’ve created counter after counter and they all work, but in this code below the counter i always stays at zero. The mapDelays count correctly shows 18. The idea is that it compares the array value at i against true or false. This is called from another method that plots pins from an airports array (18 airports). One of the items in the array is the ‘delay’ either true or false. So as I plot the airports I want to see if there is a relay ‘true’ and if there is, make the pin red instead of green. Yes, I’m a newbie so any pointers would help – specifically, flow and logic I’m obviously missing!

- (MKAnnotationView*)mapView:(MKMapView *)mapView viewForAnnotation:
(id<MKAnnotation>)annotation
{
    if ([annotation isKindOfClass:[AirportDetails class]]) {
        static NSString *const kPinIdentifier = @"AirportDetails";
        MKPinAnnotationView *view = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:kPinIdentifier];

        if (!view) {
            view = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:kPinIdentifier];
            view.canShowCallout = YES;
            view.calloutOffset = CGPointMake(-5, 5);
            view.animatesDrop = NO;
        }
        NSLog(@"I am here");
        for (int i = 0; i < self.mapDelays.count; i++) {
            NSLog(@"DelaysCount %i",i);
            NSLog(@" %i",self.mapDelays.count);
            if ([self.mapDelays[i] isEqualToString:@"true"]) {
                view.pinColor = MKPinAnnotationColorRed;
                view.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
                return view;
            } else
                view.pinColor = MKPinAnnotationColorGreen;
            view.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
            //}
            return view;
        }
    } 

    return nil;
}
  • 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-14T12:52:31+00:00Added an answer on June 14, 2026 at 12:52 pm

    After I change code format I find that at the first for loop of i you have return view; This will stop your for loop. So you have the zero. Next time you should be careful about your coding style. Especially for {}

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

Sidebar

Related Questions

I know SQL well but I must be missing something really dumb here. This
This seems very basic and I must be missing something, but here goes anyways...
I think i must be missing something simple here but I can't figure out
Must be missing something really obvious here but how do you change the size
I think I'm missing something really obvious here... must be... but for some reason
I must be missing something very simple, but can't find the answer to this.
I must be missing something obvious but I'm not sure what. I've created a
I must be missing something obvious about how the various Scanner methods work but
I must be missing something simple here, but I'm having trouble retrieving data from
Okay, I know I must be missing something obvious here. Here's the sample code

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.