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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:07:06+00:00 2026-06-04T07:07:06+00:00

I am trying to add images that have been stored to a NSMutableArray. As

  • 0

I am trying to add images that have been stored to a NSMutableArray. As loop through, I can see each image but when I try to add them to my images array, I get a count of 0.

I have the following code:

.h

#import <UIKit/UIKit.h>

@class Schedule;

@interface PMCViewController : UIViewController  <UITableViewDelegate, UITableViewDataSource>

@property (weak, nonatomic) NSMutableArray *images;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) Schedule *schedule;

- (IBAction)OpenAdmin:(id)sender;
- (IBAction)OpenSchedules:(id)sender;

@end

and them in my implementation file:

.m

- (void)viewWillAppear:(BOOL)animated {

[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES];

NSArray *schedules = [[ScheduleStore sharedStore] allSchedules];

scrollView.delegate = self;
scrollView.scrollEnabled = YES;
scrollView.pagingEnabled = YES;

int scrollWidth = 120;
scrollView.contentSize = CGSizeMake(scrollWidth,80); 

int xOffset = 0;

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

    Schedule *selectedSchedule = [schedules objectAtIndex:i];
    NSString *ik = [selectedSchedule imageKey];

    UIImageView *img = [[UIImageView alloc] init];
    //img.bounds = CGRectMake(10, 10, 50, 50);
    //img.frame = CGRectMake(5+xOffset, 0, 50, 50);
    //img.backgroundColor = [UIColor blackColor];
    //img.image = [[ScheduleImageStore sharedStore] imageForKey:ik];

    [img setBounds:CGRectMake(10, 10, 50, 50)];
    [img setFrame:CGRectMake((5+xOffset), 0, 50, 50)];
    [img setBackgroundColor:[UIColor blackColor]];
    [img setImage:[[ScheduleImageStore sharedStore] imageForKey:ik]];

    [images addObject:img];
    scrollView.contentSize = CGSizeMake(scrollWidth+xOffset,50); 
    [scrollView addSubview:[images objectAtIndex:i]];

    xOffset += 70;

}
NSLog(@"Number of img added: %i",[images count]);

[[self scheduleView] reloadData];
}

I tried both dot notation and regular notation but that didn’t make a difference. I can’t seem to add items to the images array. Could this be a memory issue? Any ideas?

  • 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-04T07:07:07+00:00Added an answer on June 4, 2026 at 7:07 am

    you need to initialise images array.

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

Sidebar

Related Questions

I'm trying to add an image to a generated html word document that is
I 'm trying to add text on a specific image. Its working perfectly but
I have been trying to add onclick event to new elements I added with
I have been trying to get images rendered in Primefaces-application. This is working fine
Possible Duplicate: Add picture at facebook event with Graph API I have been trying
I have been trying to apply the remove function to my html page but
I have a DataGridView that I'm trying to populate using a For loop: Dim
I'm trying to add images to my models in my Django app. models.py class
Ok, I am trying to add one row of multiple images to a JPanel,
I'm trying to add an image to a report. The image src url is

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.