I would like to change my animation between the view. Currently i have the PageCurl but i would like to have a Scroll animation like Snapchat.
I can not use the var transitionStyle: UIPageViewControllerTransitionStyle { get }
My ViewController :
import UIKit
class ViewController: UIPageViewController, UIPageViewControllerDataSource{
let pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil)
var messagesViewController : MessagesViewController!
var searchViewController : SearchViewController!
var friendsViewController : FriendsViewController!
override func viewDidLoad() {
super.viewDidLoad()
// set UIPageViewControllerDataSource
self.dataSource = self
// Reference all of the view controllers on the storyboard
self.messagesViewController = self.storyboard?.instantiateViewControllerWithIdentifier("messagesViewController") as? MessagesViewController
self.messagesViewController.title = "Messages"
self.searchViewController = self.storyboard?.instantiateViewControllerWithIdentifier("searchViewController") as? SearchViewController
self.searchViewController.title = "Search"
self.friendsViewController = self.storyboard?.instantiateViewControllerWithIdentifier("friendsViewController") as? FriendsViewController
self.friendsViewController.title = "Friends"
// Set starting view controllers
var startingViewControllers : NSArray = [self.searchViewController]
self.setViewControllers(startingViewControllers, direction: .Forward, animated: false, completion: nil)
}
func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {
switch viewController.title! {
case "Messages":
return nil
case "Search":
return messagesViewController
case "Friends":
return searchViewController
default:
return nil
}
}
// pink green blue
func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {
switch viewController.title! {
case "Messages":
return searchViewController
case "Search":
return friendsViewController
case "Friends":
return nil
default:
return nil
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}