I have to display images from the Photo Library using UIScrollview. Except the first image all the rest are not selected during runtime. To view them one has to scroll to the selected image. How do I view the image that I select instead of starting from the first image itself ? Thank you.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
UIImage *img = [info valueForKey: @"UIImagePickerControllerOriginalImage"];
[imagearray addObject:img];
[self dismissModalViewControllerAnimated:YES];
for (int i =0; i<[imagearray count]; i++)
{
CGFloat yOrigin = i * self.view.frame.size.width;
image = [[UIImageView alloc] initWithFrame:CGRectMake(yOrigin, 0, self.view.frame.size.width, self.view.frame.size.height)];
[image setImage:[imagearray objectAtIndex:i]];
[image setUserInteractionEnabled:YES];
[scrollView1 addSubview:image];
scrollView1.contentSize = CGSizeMake(self.view.frame.size.width * [imagearray count], 350.0);}