Harish
Harish

Reputation: 2512

Auto Scroll UISCrollView to its content Position

In my app i have an UIScrollView(in horizontal scrolling mode) and a button when a user taps the button an snap of view will be added in the scrollview as uiimageview, i have done this using,

UIGraphicsBeginImageContext(storyCreateView.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();

[storyCreateView.layer renderInContext:context];


UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); 


newscene.image=screenShot;
[galleryView addSubview:newscene];

When user adds more images the images are hidden under scrollview i want to auto scroll to right side, so that user can able to see his last added image.

Upvotes: 1

Views: 843

Answers (1)

iCreative
iCreative

Reputation: 1506

You can use setContentOffset:animated: . It Sets the offset from the content view’s origin that corresponds to the receiver’s origin.

Hope it work for you.

Upvotes: 1

Related Questions