Questions tagged [presentviewcontroller]

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.

504 questions
102
votes
5 answers

iOS 10 error [access] when using UIImagePickerController

I am using XCode 8 and testing with iOS 10.2 Beta. I have added the Photos, PhotosUI and MobileCoreServices frameworks to project. Very simple code: #import #import #import…
85
votes
17 answers

Warning: Attempt to present * on * whose view is not in the window hierarchy - swift

I'm trying to present a ViewController if there is any saved data in the data model. But I get the following error: Warning: Attempt to present * on *whose view is not in the window hierarchy" Relevant code: override func viewDidLoad() { …
Nils Wasell
  • 947
  • 1
  • 8
  • 10
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…
77
votes
13 answers

Swift presentViewController

I programatically have multiple View Controllers in an iOS Swift Project. I do not have the storyboards and would like to avoid them if possible. Is there a way to switch to another viewcontroller.swift file (We will call it view2.swift) and have it…
Z-Tech
  • 3,840
  • 4
  • 14
  • 10
71
votes
8 answers

How to call a View Controller programmatically?

I have looked at all the tutorials I can find on this one, and I still don't have the answer. I need to call another view from the code. I am using UIStoryboards. I have changed the view many times by control-dragging from UIButtons, but now it…
39
votes
4 answers

iOS: Warning "attempt to present ViewController whose view is not in the window hierarchy"

I am getting following warning when I try to present a ActivityController on navigation controller, Attempt to present on whose view is not in the window hierarchy! I have…
38
votes
9 answers

iOS: present view controller programmatically

I'm using the presentViewController:animated:completion: method to go to another view controller. This is my code: AddTaskViewController *add = [[AddTaskViewController alloc] init]; [self presentViewController:add animated:YES completion:nil]; This…
30
votes
1 answer

Present a view controller, dismiss it and present a different one in Swift

So I have a root view controller that has a button that when the user pushes it, another view controller is presented. This second controller has a dismiss option that just comes back to the root view controller and a button that when the user…
ravelinx
  • 997
  • 2
  • 11
  • 19
26
votes
11 answers

Push View from Presented View Controller in iOS

In Short : How can I PushViewController from Presented ViewController ? In Brief : I have MainViewController, In which I have one button on click of button, I am presenting a view called LoginViewController. On this page (LoginViewController), I…
25
votes
5 answers

presentViewController in AppDelegate with delay in iOS8

So I had a full working solution in iOS7 that displays a LoginViewController via presentViewController in the AppDelegate's didFinishLaunching. Basically I am doing something like this: UIViewController *backgroundViewController =…
Tiago Almeida
  • 13,437
  • 3
  • 62
  • 80
23
votes
5 answers

Using presentViewController from UIView

I am creating a title bar for my iOS application and I am making this inside a UIView. The only issue I am having is with the "home button". When the home button is pressed, it needs to go to the home page, which is ViewController. However, it…
Ashish Agarwal
  • 13,427
  • 30
  • 79
  • 122
21
votes
4 answers

"viewWillTransitionToSize:" not called in iOS 9 when the view controller is presented modally

I present a view controller from another one: - (void)showModalView { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; MySecViewController *mySecViewController = [storyboard…
20
votes
5 answers

Incorrect frame when dismissing modally presented view controller

I am presenting a UIViewController using a custom transition and a custom UIPresentationController. The view controller's view does not cover the entire screen, so the presenting view controller is still visible. Next, I present an instance of…
15
votes
4 answers

dismiss current view controller AFTER presenting new view controller - swift

I'm trying to dismiss a VC and present a new VC. but I don't want old VC to exist anymore. I use the code below to dismiss current VC and present new one. but this way, there's a time interval between dismiss and present. I don't want the user to…
Hos Ap
  • 1,080
  • 2
  • 11
  • 21
14
votes
2 answers

KEEP keyboard ON when UIAlertcontroller is presented in Swift?

When the alert pops up the keyboard is dismissed. I have looked everywhere but did not find solutions to keep the keyboard visible. When alert is presented the textfield seems to resign first responder automatically as the alert is presented…
Sam
  • 1,061
  • 2
  • 12
  • 26
1
2 3
33 34