I am presenting a model view with animation. As a default it comes from bottom to top. How can I make the animation to go from left to right? I know I could use a navigation controller. But actually the presenting view does not need a navigation bar and also the modally presented view does not need a navigation bar. Still I want a transition from left to right.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
There are only four
UIModalTransitionStyle
s:Like you said, a nav controller will push that way. If you don't want to use that, you'll have to animate the view yourself.
You can try something like this:
Just wanted to show another option - this one lets you present the view from top to bottom, using a UIView animation. please note you have to add the new view in hidden state - ensuring the animation starts with the view fully loaded.
I ran into a problem implementing Matthew's solution because the view presenting my modal view would not be visible during the animation (instead the presenting view would be replaced with the Window background and the modal view would then animate over that) which led to a jarring experience. Instead I've added the modal view as a subview to the presenting UIViewController's view and animated it across. I had a different animation requested so I've tried to change some of the values to represent the animation you're describing but I have not actually tested the code below.
Hope this helps.
You can animate from right to left while presenting a view controller by using the following code
UINavigationController
has anavigationBarHidden
property—if you set that to YES, you can get the left-to-right transition style and the other niceties of a navigation controller without having a visible navigation bar.