swift - iOS Segue - Left to Right - -


i've read other posts on segues none solve question.

simply put, viewcontrollers 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 viewcontrollers 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.

  1. i'm using navigation controller, top-left "back" button functionality. uses nav stack , works fine.

  2. however have own custom nav-bar @ bottom (back button, home button, index button, forward button) , gestures. these want have book-like functionality with.

  3. coding in swift.

  4. 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 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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -