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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:31:09+00:00 2026-05-26T12:31:09+00:00

So following Apple’s DocInteraction Sample here I put a static NSString to define some

  • 0

So following Apple’s DocInteraction Sample here I put a static NSString to define some preloaded documents. Now I need to load them into an NSArray in the viewDidLoad method. If I put it into a for() statement, it says “expression result unused”, and I know I could solve it by using documents[indexPath.row], but it’s the viewDidLoad method. So how do I forEach a static NSString for loading into the NSArray?

CODE (EDIT):

//Before @implementation

static NSString* documents[] =
{   @"Musette.pdf",
    @"Minore.pdf",
    @"Cantata.pdf",
    @"Finalé.pdf"
};
//In viewDidLoad

    if ( _icons == nil )
{        

    _icons = [[NSMutableArray alloc] init];
    UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(0, 0, 200.0, 324.0)
                                                     cornerRadius: 18.0];
    for (NSUInteger i = 1; i <= 4; i++){

        UIGraphicsBeginImageContext( CGSizeMake(200.0, 324.0) );

        // clear background
        [[UIColor clearColor] set];
        UIRectFill( CGRectMake(0.0, 0.0, 200.0, 324.0) );

        // fill the rounded rectangle
        [path fill];

        UIImage *image = [UIImage imageNamed:@"ClearImage.png"];

        UIGraphicsEndImageContext();

        // put the image into our list
        [_icons addObject: image];
    }
}

[_gridView reloadData];
  • 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-26T12:31:09+00:00Added an answer on May 26, 2026 at 12:31 pm

    C-arrays are not supported by the for-each modification of the for statement in Objective-C. So you have 2 choices here:

    1. use ordinary for-statement cycle

      for(int idx = 0; idx < KNOWN_DOCUMENTS_COUNT; ++idx) {
      …
      }

    2. Create a custom subclass of the NSEnumerator and use it… however, I believe, this will be a big overhead for this case

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

Sidebar

Related Questions

I have downloaded sample code from Apple Center.I also have gone through following question:
Apple provides the following sample code in their QuickContacts project for how to search
I have this following test code: public static final String[] list = { apple,ball,cat,dog,egg,fan,girl,hat,igloo,jerk
Following Chris Hanson's blogs and Apple's Automated Unit Testing with Xcode 3 and Objective-C
Apple advises using the following code to detect whether running on an iPad or
I have the following code: import com.apple.dnssd.*; public interface IServiceAnnouncer { public void registerService();
Apple's Technical Q&A on addressing flickering (QA1650) includes the following paragraph. (Emphasis mine.) You
I've got following URL in symfony (specifics not important): /frontend_dev.php/something/25/apple ... and a routing
I have the following tuple, which contains tuples: MY_TUPLE = ( ('A','Apple'), ('C','Carrot'), ('B','Banana'),
Given the following markup: <ul> <li>apple</li> <li class=highlight>orange</li> <li>pear</li> </ul> Both the ul s

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.