On iPhone and iPod touch, the presented view is always full screen. On iPad, the presentation depends on the value in the modalPresentationStyle property. This method sets the presentedViewController property to the specified view controller, resizes that view controller’s view and then adds the view to the view hierarchy.
Questions tagged [presentviewcontroller]
504 questions
8
votes
1 answer
UIModalPresentationStyle.FormSheet Always full screen on iPad (SWIFT)
I'm trying to translate some Objective-C code to SWIFT.
I'm loading a UIViewController as a Form Sheet.
Here's the code in objective-c:
generalPopup.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
generalPopup.modalPresentationStyle =…
![](../../users/profiles/915824.webp)
YogevSitton
- 9,578
- 10
- 55
- 90
7
votes
1 answer
How to presentViewController embedded in UITabBarController and UINavigationBarController
When using 3D Touch Shortcuts from the home screen I am trying to segue to different view controller.
The application is embedded within a UITabBarController and each tab root controller is a UINavigationController.
Here is how I attempted…
![](../../users/profiles/4556409.webp)
RileyDev
- 3,110
- 3
- 18
- 49
7
votes
1 answer
Presenting a view controller without changing the status bar color, like UIAlertController
When performing some network operations, I present a modal view controller (similar to MBProgressHUD but as a view controller) to prevent user interaction and indicate progress.
The view controller has modalPresentationStyle = .Custom and is…
![](../../users/profiles/860000.webp)
Brian Nickel
- 25,119
- 5
- 81
- 108
7
votes
1 answer
Swift: Prevent ABPeoplePickerNavigationController from Closing
I'd like to figure out a way so that, if the user presses the "Cancel" button (which I don't believe can be removed) in an ABPeoplePickerNavigationController, the view controller either doesn't close, or will be automatically reopened.
For example,…
![](../../users/profiles/2809263.webp)
Randoms
- 1,980
- 2
- 18
- 29
7
votes
1 answer
Custom View Transition without use of Storyboard segues (Swift)
I have two views I would like to make a swipe style transition accross and I have done that when there is a segue to act on but the I don't have one here so am not sure how to apply my animation class. All I have in my class is:
let stb =…
![](../../users/profiles/4153233.webp)
SashaZ
- 403
- 5
- 20
7
votes
1 answer
Adding a view to the window hierarchy
I am trying to create a pause screen on my game. I have added a 'PauseScreen' viewController in my storyboard with the Storyboard ID and Restoration ID set as "PauseScreenID" and to move to the pause screen I have have created the function in…
![](../../users/profiles/4196389.webp)
Ben Oneill
- 101
- 1
- 2
- 8
7
votes
2 answers
How to present a semi-transparent (half-cut) viewcontroller in iOS 8
in iOS 7 there is no problem for this method:
_rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[_rootViewController presentViewController:self animated:NO completion:nil];
But in iOS 8 it did nothing.How to solve it?…
![](../../users/profiles/2016787.webp)
SuperHappy
- 161
- 2
- 10
7
votes
4 answers
How to dismiss own view controller and present another view controller in a button tap?
Let's say I have 3 view controller labeled "A","B" and "C".
Right now, "A" is the rootViewController of the window and it presents "B" modally when a button is tapped. In "B", when a button is tapped it is supposed to be dismissed by "A" and then…
![](../../users/profiles/3526002.webp)
user3526002
- 495
- 2
- 6
- 17
6
votes
5 answers
How to simultaneously present two view controllers?
My goal is to present a view controller without dismissing directly to its presentingViewController.
To make it more clear, consider the following example:
Referring to this storyboard:
Assuming that the first black view controller is the first…
![](../../users/profiles/5501940.webp)
Ahmad F
- 26,570
- 13
- 76
- 124
6
votes
5 answers
How to handle Menu Button action in tvOS remote
I am facing the strange problem with my application. Actually when i am presenting a view controller for play the video. At the video load time user press the menu button the application goes to background. While i have overwrite the Menu Button…
![](../../users/profiles/4713405.webp)
Sankalap Yaduraj Singh
- 1,007
- 1
- 12
- 30
6
votes
3 answers
iOS Swift window.rootViewController vs presentViewController
What is the best practice to switch between multiple views; change the rootViewController or use modal views?
Setting the rootviewController:
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var vc : UIViewController =…
![](../../users/profiles/2718075.webp)
user2718075
- 323
- 2
- 4
- 14
6
votes
2 answers
iOS presentViewController doesn't invoke viewDidLoad
I'm implementing my own 'back' button. Where onClick, the following code is executed in the ViewController (VC) being dismissed:
Dismiss current VC (VC#1)
Pop current VC (VC#1) off my custom navigationStack
Get the last VC (VC#2) from the…
![](../../users/profiles/1175956.webp)
snowbound
- 1,472
- 2
- 17
- 27
5
votes
2 answers
Presenting View Controller in SwiftUI
How to achieve what the following Objective-C code achieves with SwiftUI? I haven't been able to get a firm grasp on the ideas presented.
[self presentViewController:messageViewController animated:YES completion:nil];
user12919782
5
votes
2 answers
Present a ViewController inside guard statement swift
I am trying to present a viewcontroller in case, status (an Int?) is nil as follows:
guard let statusCode = status else {
DispatchQueue.main.async() {
let initViewController =…
![](../../users/profiles/7271020.webp)
sandpat
- 1,280
- 9
- 25
5
votes
1 answer
Black screen when dismissing a UIViewController with custom transition from within a UINavigationController
I have a view controller FromViewController and I want it to present a ToViewController with a custom transition. I have implemented the UIViewControllerAnimatedTransitioning for both the to- and from-transitions and it's all working nicely when I…
![](../../users/profiles/569507.webp)
pajevic
- 4,300
- 4
- 31
- 63