ios - swift : show another view controller on swipe up in first view controller -


hi checked many questions regarding swiping in have doubts .

in app have 2 pages 1. user view controller 2. question view controller

user page looks userpage

now want implement show questions view controller while swiping users screen bottom.

i new ios, me in achieving this.

edit:

the problem while swiping should start showing other view controller. if swiped till middle of screen finger still touching screen, should show 2 view controllers.can achieve using push/pop this

enter image description here

first you'll have add uipangesturerecognizer "questions bar" can pan show questions view.

to handle multiple view controllers, can use container view controller:

var pendingviewcontroller: uiviewcontroller? {     didset {         if let pending = pendingviewcontroller {             addchildviewcontroller(pending)             pending.didmovetoparentviewcontroller(self)              pending.view.frame.origin.y = uiscreen.mainscreen().bounds.height              view.addsubview(pending.view)         }     } }  var currentviewcontroller: uiviewcontroller? { didset { pendingviewcontroller = nil } }  func showquestions(recognizer: uipangesturerecognizer) {     if recognizer.state == .began {         let controller = questionviewcontroller() // create instance of question view controller         pendingviewcontroller = controller     }      if recognizer.state == .changed {         let translation = recognizer.translationinview(view)          // insert code here move whatever want move question view controller view          pendingviewcontroller.view.center.y += translation.y         recognizer.settranslation(cgpointzero, inview: view)     }      if recognizer.state == .ended {         // animate view it's location     } } 

something this. typed manually there might mistakes.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -