Questions tagged [dismissviewcontroller]
47 questions
82
votes
6 answers
modal View controllers - how to display and dismiss
I'm breaking my head for the last one week on how to solve the issue with showing and dismissing multiple view controllers. I have created a sample project and pasting the code directly from the project. I have 3 view controllers with their…

Hema
- 947
- 1
- 8
- 13
13
votes
4 answers
How to dismiss 2 view controller in swift ios?
How to dismiss 2 view controllers in Swift iOS?
Below is my code.
@IBAction func backButtonTapped(sender: AnyObject) {
self.presentingViewController
.presentingViewController
.dismissViewControllerAnimated(true, completion:…

viju
- 91
- 2
- 3
- 14
3
votes
1 answer
Dismiss only presented view controller not the whole navigation stack Swift
I have a tab bar controller. In that the first tab is a navigation controller. Lets call it controller A. I am then pushing another view controller on it. Lets call it controller B.
After that I am presenting view controller C from View controller…

Swapstar
- 223
- 2
- 10
3
votes
1 answer
how to close all view controllers that presented modally inFront of each other with unwind segue in swift?
so I have a main view controller that the view controllers will present inFront of each other and I want when user click the button in the last view controller close all of the presented modally view controllers so I used this code But I didn't get…

Saeed Rahmatolahi
- 1,317
- 2
- 27
- 60
2
votes
2 answers
Close a modal view with a button in Swift?
Learning some view controller basics and am stuck on how to dismiss a modal with a button.
In my slimmed-down example, I have a two view setup with the initial view and the modal. The first view has a button that successfully pops up the modal. On…

Sam
- 2,152
- 6
- 31
- 44
2
votes
1 answer
Swift: Presenting modally and dismissing a navigation controller
I have a very common iOS app scenario:
The MainVC of the app is a UITabBarController. I set this VC as the rootViewController in the AppDelegate.swift file:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:…

christostsang
- 1,701
- 3
- 27
- 46
1
vote
0 answers
Swift 5: Unbalanced calls to begin/end appearance transitions for xxViewController when i try dismiss views
i have two errors "Unbalanced calls to begin/end appearance transitions for DonesViewController"(its my last viewcontroller) and the same error fot BottomSheetViewController, when i try to dismiss all views and go to main view.
I have a navigation…

akitainu22
- 95
- 1
- 8
1
vote
1 answer
Perform function on Dismiss of a View Controller
i am calling a GET(method) API on viewDidAppear function of a view controller. i am presenting a new view controller using navigation controller over my first view controller. on the second view controller i am calling an API of Post Method to add…

Taimoor Arif
- 750
- 3
- 19
1
vote
0 answers
fullScreenCover Dismiss with Drag SWIFTUI
Is it possible to dismiss a View with a scroll view by dragging down when in .fullScreenCover? I know .sheets can, but can it be done with fullScreenCover? I very new at swift.

Rene Robles
- 83
- 1
- 6
1
vote
1 answer
Dismiss a View Controller and present a new one in the same method - swift
Summary of problem
I have two View Controllers (VC1 = MainViewController and VC2 = ResultViewController).
In VC1 there is a method called endGame(). In this method I want to both dismiss VC1 and present VC2.
In VC2 there is a button function…

Jaiden Ryder
- 25
- 6
1
vote
1 answer
Stop Dismissing UIViewController While User finished Action in UIAlertControl
How to handle action of alert controller button tapped, then continue dismissing of current view controller?
Some Peace of Code:
internal func dismissPasscodeLock(_ lock: PasscodeLockType, completionHandler: (() -> Void)? = nil) {
// create…

Oleg Savelyev
- 275
- 4
- 16
1
vote
5 answers
Swift: Call a method from ViewController1 after dismissing ViewController2
I'm currently building a homework tracking app where you can add courses in a TableView. In one ViewController, I have a list of courses that already exist. I also have a button that allows the user to add new courses. When they click the button,…

Vikram Singh
- 23
- 5
1
vote
1 answer
How to run code when view controller in iOS is dismissed by swiping down?
I have a view controller that I present in my iOS app using Swift and Xcode that is able to be dismissed by swiping down on it. I need to implement code that executes when the user swipes down on the view controller to dismiss it. I suspect there is…

daniel
- 1,446
- 3
- 29
- 65
1
vote
1 answer
SwiftUI - Dismiss Keyboard when Picker selected
Is there a simple means of dismissing the keyboard or any other active control when another control such as a date picker becomes active? Or vice versa.
There are some solutions for dismissing the keyboard, but which also disable the use of a…

Yarm
- 1,178
- 4
- 16
- 29
1
vote
3 answers
Issue on dismissing a viewController to rootViewController
I am trying to dismiss a viewController to rootViewController while signOut. But the problem is that the viewController is not getting dismissed, It still remains in the same page itself.
Below I have mentioned the code that I have used.
let…

Wide Angle Technology
- 1,184
- 1
- 8
- 28