I have scrollview to show images. I need timer to show images one after another for every 5 seconds. How to initiate UIScrollView event to move next after 5 sec using timer?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
Add the variable int h to your interface, and yourScrollView as a property. Then:
Swift version
Add the following properties
Modify the
viewDidLoad()
create this function for automatic scroll
Add this function for manual scroll
Note: Though the question is specific to automatic scroll, I have added manual scroll as well. So that both automatic scroll and manual scroll work in tandem. Also, I have added a
UIPageControl
. Please remove theimagePageControl
if you don't need it.to get current value as w (x value) or h (y value) of content. This helps with manual/semi automatic scrolling with the current reference point in your content of your UIScollView.
or
then of course:
modifying the above code
Maybe, [scroll scrollRectToVisibile:animated:] is better than [scroll setContentOffset]. Because setContentOffset will lead to scrolling out of edge. Just have a try!