ios - How to make tab bar view controller animate like modal transition? Like iTunes? -
ok, having tab bar controller animation problems trying mimic animation transition in apple's itunes when leave music player vc. right have media bar uiview sits on bottom of screen , animates whenever select tab isn't music player view (so selectedindex != (viewcontrollers?.count)!-1
)
this fine, looking @ other tab bar animations cant make vertical/squish animation transition itunes. answer gave me how horizontally page - iphone: how switch tabs animation?
however doesn't work when make vertical. want dismiss transition if tab modal view controller. have:
func animatetotab(toindex: int) { let tabviewcontrollers = viewcontrollers! let fromview = selectedviewcontroller!.view let toview = tabviewcontrollers[toindex].view let fromindex = tabviewcontrollers.index(of: selectedviewcontroller!) guard fromindex != toindex else {return} // add toview tab bar view fromview?.superview!.addsubview(toview!) fromview?.superview!.sendsubview(toback: toview!) // disable interaction during animation view.isuserinteractionenabled = false uiview.animate(withduration: 0.5, delay: 0.0, usingspringwithdamping: 1, initialspringvelocity: 0.3, options: uiviewanimationoptions.curveeaseout, animations: { // slide views -offset fromview?.superview!.center.y += screensize.height //toview?.center = cgpoint(x: (toview?.center.x)! - offset, y: (toview?.center.y)!); }, completion: { finished in // remove old view tabbar view. fromview?.removefromsuperview() self.view.isuserinteractionenabled = true }) self.selectedindex = toindex }
but current vc, music player, snaps original position after moves , switches selectedindex. tab bar controller makes viewcontrollers in right position before switching.
how can mimic modal dismiss animation tab bar vc?
Comments
Post a Comment