Scroll Programmatically with keyframe animation Xcode 6.1 IOS 8.1 tutorial
You need a ScrollView in a singleView, or you need a TableView, which has a ScrollView. I use TableViewController, but if you don't use this, please check the UIScrollViewDelegate method before call scrollViewDidScroll: .
3 steps need
Create TableViewControllers - Settings
Detect when the user scrolling
Detect when user stops scrolling, and start our keyframe animation
1. Create TableViewControllers - Settings
1.1. Create TableViewController subclass - New File - Cocoa Touch - UITableViewController type - Name: MyTableviewController
1.2. In MyTableViewController.m file create myArray NSArray, and synthesize it in .m file. Set TableView Section count 1 and rows set to myArray.count
1.3. Create MyTableViewController on Main storyboard, and add class MyTableViewController.
1.4. Add UIButton to your ViewController, and ctrl drag to TableViewController, and select “Show” to this segue.
1.5. Add “Cell” to the Prototype Cell Reuse Identifier
1.6. Set cell label with this code:
2. Detect when the user scrolling
2.1. Detect scroll offset if the user scrolling, use scrollViewDidScroll:
2.2. Test your app, run in Simulator. Now you can check offset data in log.
3. Detect when user stops scrolling, and start our keyframe animation
We can detect, if the user stop scrolling, just we need to use scrollViewDidEndDragging:. And we can continue the user scrolling with keyframe animation. We can also add if statement, so, if the user scroll more, than “-100” and endDragging, we can start our animation. So we need a startOffset, it will be that value, where the user finishes scrolling. With keyframe animation, you can use more little animation as a one animation, so you can add start time and duration for all steps, and finally, should be compared with the total animation time. I do every step with -50 at startOffset.y, in 0.05 min, so it will be nature scroll animation to your eyes.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality
Anya is LIVE right now
FREE
Free to watch • No registration required • HD streaming
Top Posts Tagged with #scrolling programmatically | Tumlook