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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:17:15+00:00 2026-06-03T13:17:15+00:00

How can I improve my code here, that has an array of image to

  • 0

How can I improve my code here, that has an array of image to have/assign a specific integer,value or number. that whenever it is displayed I can draw a circle on it programmatically. Could anyone suggest a way?

- (void)awakeFromNib
{    
    if (self) {

        self.images = [NSMutableArray arrayWithObjects:@"111.jpg",
                       @"112.jpg",
                       @"113.jpg",
                       @"114.jpg",
                       @"115.jpg",
                       @"116.jpg",
                       @"117.jpg",
                       @"118.png",
                       @"119.jpg",
                       @"120.jpg",
                       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-03T13:17:17+00:00Added an answer on June 3, 2026 at 1:17 pm

    Create an array of NSDictionaries (instead of strings) and each dictionary can contain a key for the image name plus whatever other keys you want to add. Or even better, create an array of your own custom object (subclass NSObject) and then you can access the properties of each entry in the array without having to do a dictionary lookup.

    Here is some sample code for the NSDictionary method:

    - (id)init
    {
        ...
        images = [[NSMutableArray alloc] init];
        ...
    }
    
    - (void)dealloc
    {
        ...
        [images release];
        [super dealloc];
    }
    
    - (void)addImagesToArrayWithImageName:(NSString *)imageName andTag:(int)tag
    {
        NSMutableDictionary *dict = [NSMutableDictionary dictionary];
        [dict setObject:imageName forKey:@"imageName"];
        [dict setObject:[NSNUmber numberWithInt:tag] forKey:@"tag"];
        [images addObject:dict];
    }
    
    - (void)awakeFromNib
    {
        [self addImagesToArrayWithImageName:@"111.jpg" andTag:0];
        [self addImagesToArrayWithImageName:@"112.jpg" andTag:1];
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I improve this code? What has made this long winded is the
I have an idea of how I can improve the performance with dynamic code
I have read that you can do it, but would this really improve performance
I have a piece of code that I don't know how to improve it.
I have some code that I wanted to improve. It uses Process.Start and should
I've hacked together some php code that can probably be improved in terms of
What kind of trick can I use to speed up and improve an image
I'm sitting here writing a function that I'm positive has been written before, somewhere
Can the following code cause a memory leak? Would using a StringBuffer actually improve
I have a an Android ListView that has small (say, 1-5 frame) stutters as

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.