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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:46:06+00:00 2026-05-22T22:46:06+00:00

<?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd> <plist version=1.0> <array> <array>

  • 0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
  <array>
    <string>Title 1</string>
    <string>Subtitle 1</string>
    <string>image1.png</string>
  </array>
  <array>
    <string>Title 2</string>
    <string>Subtitle 2</string>
    <string>image2.png</string>
  </array>
</array>
</plist>

This is my Plist file for an app I am working on.

I am not sure on how to take the first string of many arrays to create an NSMutableArray with all the titles and again for the subtitles and image names.

My workaround at the moment is creating 3 separate Plist files for each type of string which can be a nuisance.

  • 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-22T22:46:06+00:00Added an answer on May 22, 2026 at 10:46 pm

    To answer your question while retaining the plist data structure, you could simply do something like the following:

    NSArray *rootArray = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"your-plist" ofType:@"plist"]];
    int numItems = [rootArray count];
    NSMutableArray *titles = [NSMutableArray arrayWithCapacity:numItems];
    NSMutableArray *subtitles = [NSMutableArray arrayWithCapacity:numItems];
    NSMutableArray *images = [NSMutableArray arrayWithCapacity:numItems];
    
    for (NSArray *itemData in rootArray) {
        [titles addObject:[itemData objectAtIndex:0]];
        [subtitles addObject:[itemData objectAtIndex:1]];
        [images addObject:[itemData objectAtIndex:2]];
    }
    

    However, I would advise you to use a structure like:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
      <dict>
        <key>title</key>
        <string>Title 1</string>
        <key>subtitle</key>
        <string>Subtitle 1</string>
        <key>image</key>
        <string>image1.png</string>
      </dict>
      <dict>
        <key>title</key>
        <string>Title 2</string>
        <key>subtitle</key>
        <string>Subtitle 2</string>
        <key>image</key>
        <string>image2.png</string>
      </dict>
    </array>
    </plist>
    

    At which point you could use the more explicit code as follows:

    NSArray *rootArray = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"your-plist" ofType:@"plist"]];
    int numItems = [rootArray count];
    NSMutableArray *titles = [NSMutableArray arrayWithCapacity:numItems];
    NSMutableArray *subtitles = [NSMutableArray arrayWithCapacity:numItems];
    NSMutableArray *images = [NSMutableArray arrayWithCapacity:numItems];
    
    for (NSDictionary *itemData in rootArray) {
        [titles addObject:[itemData objectForKey:@"title"]];
        [subtitles addObject:[itemData objectForKey:@"subtitle"]];
        [images addObject:[itemData objectForKey:@"image"]];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
String newpage = <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <!DOCTYPE plist PUBLIC '-//Apple//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'>
I have a plist structured like this: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD
This is my xhtml code : <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC -//W3C//DTD
I have this XML at http://localhost/file.xml : <?xml version=1.0 encoding=utf-8?> <val:Root xmlns:val=http://www.hw-group.com/XMLSchema/ste/values.xsd> <Agent> <Version>2.0.3</Version>
I made a plist that looks like that: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC
Here's the XML: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <feed xmlns=http://www.w3.org/2005/Atom xmlns:dc=http://purl.org/dc/elements/1.1/> <title>Rated Images</title> <link
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I am trying to parse the following XML with javascript: <?xml version='1.0' encoding='UTF-8'?> <ResultSet>
I have the following simplified XML: <?xml version="1.0" encoding="UTF-8" ?> <MATMAS05> <IDOC BEGIN="1"> <E1MARAM

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.