Reputation: 571
I have a UITextView which displays some notes the user wrote down. There are multiple pages of notes. I added a swipe gesture recognizer to the text view so that it flips to the next page if the user swipes to the left, and previous page if the user swipes to the right. I want to add sliding animations when the user swipes. That is, when the user swipes to the left, the current page slides out to the left and the following page slides in from the right.
I saw some other posts saying that CATransition
can be used for this purpose but looks like there has to be at least two views, but I only have one here (the UITextView). So what's the best way to achieve the sliding effect in my case?
EDIT: Looks like UIScrollView
, the super class of UITextView
could be configured to enable the paging effect. Is there anyway to directly enable paging on the scroll view part of the text view?
Upvotes: 2
Views: 2709
Reputation: 571
You can use UIPageViewController to achieve the swipe effect with animation. Follow this tutorial for setting up the view controllers and this post for a possible bug in the SDK and the corresponding workaround.
Upvotes: 3
Reputation: 10083
Checkout the following links. Maybe these will help you. Download the demos from git from each link and check.
https://github.com/xissburg/XBPageCurl https://github.com/Dillion/iOS-Flip-Transform
and I guess this is what you are trying to achieve- https://github.com/brow/leaves
Also check How to do Animation like BooK front cover in iOS?
Hope that helps.
Upvotes: 0