creating a previous uiimage button in xcode
 I have an array of images set up to display randomly ( in no given order). I want my previousbutton button to be able to display the previous image that was currently shown



//this is my next button which shows an array of random images in no particular order




    -(IBAction)nextbutton:(id)sender;
    {
	int ptr = rand() % 6;
	NSArray *images = [[NSArray alloc] initWithObjects:@"Americans.png",@"Approach.png",@"Arianny.png",@"Atoms.png",@"Australia.png",@"Average.png",nil];
	
    }

//this is the problem i am having I want this button to show the image that was shown previously. from the array randomized above but it doesnt do that



      -(IBAction)previousbutton:(id)sender;
    {

	
		int ptr=0;
		
		if (ptr <=5)
		{ 
			
			ptr = 5;
			ptr--;
			[imageView setImage:[images objectAtIndex:ptr]];
		}
	
		NSArray *images = [[NSArray alloc]               initWithObjects:@"Americans.png",@"Approach.png",@"Arianny.png",@"Atoms.png",@"Australia.png   ",@"Average.png",nil];
		
		[imageView setImage:[UIImage imageNamed:[images objectAtIndex:ptr]]];
	}

creating a previous uiimage button in xcode
===

 I have an array of images set up to display randomly ( in no given order). I want my previousbutton button to be able to display the previous image that was currently shown



//this is my next button which shows an array of random images in no particular order




    -(IBAction)nextbutton:(id)sender;
    {
	int ptr = rand() % 6;
	NSArray *images = [[NSArray alloc] initWithObjects:@"Americans.png",@"Approach.png",@"Arianny.png",@"Atoms.png",@"Australia.png",@"Average.png",nil];
	
    }

//this is the problem i am having I want this button to show the image that was shown previously. from the array randomized above but it doesnt do that



      -(IBAction)previousbutton:(id)sender;
    {

	
		int ptr=0;
		
		if (ptr <=5)
		{ 
			
			ptr = 5;
			ptr--;
			[imageView setImage:[images objectAtIndex:ptr]];
		}
	
		NSArray *images = [[NSArray alloc]               initWithObjects:@"Americans.png",@"Approach.png",@"Arianny.png",@"Atoms.png",@"Australia.png   ",@"Average.png",nil];
		
		[imageView setImage:[UIImage imageNamed:[images objectAtIndex:ptr]]];
	}
