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

  • Home
  • SEARCH
  • 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 8020433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:41:29+00:00 2026-06-04T21:41:29+00:00

I load my annotations from plist and loop categories NSMutableArray *annotations = [[NSMutableArray alloc]init];

  • 0

I load my annotations from plist and loop categories

NSMutableArray *annotations = [[NSMutableArray alloc]init];

NSString *path = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];

for(path in dict){

NSString *theCategory;

theCategory = [NSString stringWithFormat:@"%@", path];
NSLog(@"%@", path);

NSArray *ann = [dict objectForKey:theCategory];


for(int i = 0; i < [ann count]; i++) {


    NSString *coordinates = [[ann objectAtIndex:i] objectForKey:@"Coordinates"];

    double realLatitude = [[[coordinates componentsSeparatedByString:@","] objectAtIndex:1] doubleValue];
    double realLongitude = [[[coordinates componentsSeparatedByString:@","] objectAtIndex:0] doubleValue];

    MyAnnotation *myAnnotation = [[MyAnnotation alloc] init];
    CLLocationCoordinate2D theCoordinate;
    theCoordinate.latitude = realLatitude;
    theCoordinate.longitude = realLongitude;

    myAnnotation.coordinate=CLLocationCoordinate2DMake(realLatitude,realLongitude);        
    myAnnotation.title = [[ann objectAtIndex:i] objectForKey:@"Name"];
    myAnnotation.subtitle = [[ann objectAtIndex:i] objectForKey:@"Address"];
    myAnnotation.icon = [[ann objectAtIndex:0] objectForKey:@"Icon"];


    [mapView addAnnotation:myAnnotation];
    [annotations addObject:myAnnotation];

}

}   

Then I have an switch in my settings

- (IBAction)saveSwitch:(id)sender
{
    NSUserDefaults *defs1 = [NSUserDefaults standardUserDefaults];
    [defs1 setBool: blackSwitch.on forKey: @"blackKey"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

I need to limit display of annotations from specific category by this switch. How it can be done, if I loop categories?

  • 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-04T21:41:30+00:00Added an answer on June 4, 2026 at 9:41 pm

    Inside your first loop, do this:

    for(NSString *category in dict){
        if ([category isEqualToString:@"Whatever"]) {
            //continue?
            NSArray *ann = [dict objectForKey:category];
            BOOL blackKeyStatus = [[NSUserDefaults standardUserDefaults]boolForKey:@"blackKey"];
    
            if (blackKeyStatus) {
                //switch ON
                //act appropriatelyForOnValue
                //begin Loop 2 here?
            } else {
                //switch OFF
                //act appropriately
            }
    
        } else {
            //do something else?
        }
    

    If you’re needing to test for a specific condition, do whatever is necessary to identify if that condition is met.

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

Sidebar

Related Questions

I am trying to load some data from DB in the init method of
I load annotations from a plist file and also I need to read images
ViewA load some data from Coredata, then push to the next viewB . In
I am writing an app can load data from from web, then put the
I load my animated character with a huge texture this way: [[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@MyFile.plist]; And
I load a form and dynamically populate a select via AJAX from a PHP
I have this new challenge to load ~100M rows from an Oracle database and
I'd like to load some Java .class files and extract information from them. I
I am using data annotations to validation my class properties. A requirement has emerged
Hey fellas, so I am able to display annotations (2) from the source 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.