New to iOS coding, so this is probably more of a syntax question than anything else. I am trying to implement a UIImageView loaded with an array of image objects. On right swipe, I want to move to the next object in the array, and load it into the view. I have the array loaded fine, just don’t know how, syntactically, how to get the current position in the array. I realize this is a total n00b question, so free reputation cred for you.
Heres some code:
- (void)viewDidLoad
{
[super viewDidLoad];
imageArray = [NSArray arrayWithObjects:[UIImage imageNamed:@"1.jpg"],[UIImage imageNamed:@"2.jpg"], nil];
imageView.image = [imageArray objectAtIndex:0];
}
- (IBAction)swipeRightGesture:(id)sender {
imageView.image = [imageArray somethingsomething];//load next object in array
}
1 Answer