swift - iOS Segue - Left to Right - -
i've read other posts on segues none solve question.
simply put, viewcontroller
s ordered, book. want backward transitions (example: page 9 8) present (slide over) left right. want forward transitions (from page 9 10) present right left.
yes, nav-controller button (top left) presents if paging through page page. however, if jump in index function on nav controller takes index.
my objective if user jumps page 9 (for example) index, swipes right, it'll flick page off right , show page 8. once on page 8, if flick left page flicked off left , they'll on page 9 again.
all viewcontroller
s by, default, presenting sliding in right left.
example: think of book, if use index hop chapter 4, swipe right , pop view stack, i'll @ index. if you're on chapter 4, page 394 , swipe right, don't want go index! want go last page of chapter 3, page 393! nav stack no me.
end example
details: 1. i'm using new xcode "show" on button-tap switch between viewcontrollers.
i'm using navigation controller, top-left "back" button functionality. uses nav stack , works fine.
however have own custom nav-bar @ bottom (back button, home button, index button, forward button) , gestures. these want have book-like functionality with.
coding in swift.
working xcode 6.3
i've read there's animation code. i've read there's in depth programatic transitions can used. seems crazy there's no simple way select segues want present left , reverse animation.
thanks!
attempt log:
i tried dcdc's code: uiview.transitionwithview(self.window!, duration: 0.5, options:.transitionflipfromleft, animations: { () -> void in self.window!.rootviewcontroller = mainvc }, completion:nil)
this error returned when insert dcdc's code ibaction
back-swipe
this how achieve effect without requiring nav-controller. try instead:
import uikit class seguefromleft: uistoryboardsegue { override func perform() { let src = self.sourceviewcontroller let dst = self.destinationviewcontroller src.view.superview?.insertsubview(dst.view, abovesubview: src.view) dst.view.transform = cgaffinetransformmaketranslation(-src.view.frame.size.width, 0) uiview.animatewithduration(0.25, delay: 0.0, options: uiviewanimationoptions.curveeaseinout, animations: { dst.view.transform = cgaffinetransformmaketranslation(0, 0) }, completion: { finished in src.presentviewcontroller(dst, animated: false, completion: nil) } ) } }
then in storyboard, click on segue you'd change. in attributes inspector change type 'custom' , change class 'seguefromleft'
Comments
Post a Comment