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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:16:38+00:00 2026-06-08T18:16:38+00:00

So, the code I use to set the image originally (it receives data from

  • 0

So, the code I use to set the image originally (it receives data from another iOS device over BlueTooth)

    UIImage *receivedImage = [UIImage imageWithData:data];
        if(receivedImage != nil)
        {
            NSLog(@"Image received is not nil.");
        }
        self.imageView.image = receivedImage;
        UIImageView *iv = [[UIImageView alloc] initWithImage:receivedImage];
        [self.view addSubview:iv];

        [self.photoAlbum addObject:receivedImage];

works like a charm with setting the image.

However, when I try to add it to the NSMutableArray property “album,” the image doesn’t change.

  -(void)stereoscopicIterationA {
    self.imageView.image = nil;
    self.imageView.image = [self.photoAlbum objectAtIndex:1];
    NSTimer *theTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(stereoscopicIterationB) userInfo:nil repeats:NO];
    NSLog(@"Image 1");

}

-(void)stereoscopicIterationB {
    self.imageView.image = nil;
    self.imageView.image = [self.photoAlbum objectAtIndex:0];
    NSTimer *theTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(stereoscopicIterationA) userInfo:nil repeats:NO];
    NSLog(@"Image 0");
}

-(void)openAlbum:(id)sender
{

    if([self.photoAlbum objectAtIndex:0] != nil && [self.photoAlbum objectAtIndex:1] == nil)
    {
    self.imageView.image = [self.photoAlbum objectAtIndex:0];


    [self dismissModalViewControllerAnimated:NO];
    }
    else if([self.photoAlbum objectAtIndex:0] !=nil && [self.photoAlbum objectAtIndex:1] !=nil ){
        //Set up NSTimer to swap self.imageView.image back and forth between 0 and 1 of photoAlbum.
        NSLog(@"Timer set up");
        NSTimer *theTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(stereoscopicIterationA) userInfo:nil repeats:YES];

    }

Any ideas?

More specifically, it looks like the images aren’t added/kept into the album NSMutableArray at all. The program crashes with an out of bounds error [0 .. 0].

  • 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-08T18:16:39+00:00Added an answer on June 8, 2026 at 6:16 pm

    It sounds, from the update to your question, as though self.photoAlbum is nil. You need to make sure you’ve allocated the array, and assigned it into self.photoAlbum.

    Do this:

    self.photoAlbum = [[NSMutableArray alloc] init];
    

    before you try adding to the array.

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

Sidebar

Related Questions

I use this code: [image setImage:[UIImage imageNamed:@some@2x.png]]; and it work on ios 4.3, but
Why cant i use code nuggets to set a control property??For example a validationgroup
I use this code to set the background. It do change the background, but
I am attempting to use the code-behind (Page_Load or PreRender) to set a date-time
I'm trying to use ResolveUrl() to set some paths in the code behind of
In Flash Builder (flex 4) I try to use next code to set selected
I use the following code: Calendar calendar = new GregorianCalendar(0,0,0); calendar.set(Calendar.YEAR, 1942); calendar.set(Calendar.MONTH, 3);
To use custom layout file in my app I'm using this following code, set
i am new to android development. I am use the following code to set
I want to set the Image to be Selected from the Android Gallery. I

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.