Questions tagged [uiviewcontroller]

The UIViewController class manages the views in iOS apps and mediates the interaction between an app's views, its underlying model objects, and the overall workflow.

The UIViewController class manages the views in iOS and watch-os apps and mediates the interaction between an app's views, its underlying model objects, and the overall workflow.

View controllers are the foundation of your app’s internal structure. Every app has at least one view controller, and most apps have several. Each view controller manages a portion of your app’s user interface as well as the interactions between that interface and the underlying data. View controllers also facilitate transitions between different parts of your user interface.

To quote from the Overview of the UIViewController Class Reference:

The UIViewController class provides the fundamental view-management model for all iOS apps. You rarely instantiate UIViewController objects directly. Instead, you instantiate subclasses of the UIViewController class based on the specific task each subclass performs. A view controller manages a set of views that make up a portion of your app’s user interface. As part of the controller layer of your app, a view controller coordinates its efforts with model objects and other controller objects—including other view controllers—so your app presents a single coherent user interface.

References:

16290 questions
4
votes
1 answer

Preventing unhandled touch events on a child view controller from passing through to container view

I have a container view controller managing its own full-screen content view, with several gesture recognizers attached. A child view controller can be overlaid over a portion of the screen; its root view is a UIView providing the opaque background…
4bar
  • 531
  • 2
  • 14
4
votes
0 answers

How do you use UIViewControllerTransitionCoordinator?

The documentation of UIViewControllerTransitionCoordinator isn't very detailed. It implies that you may want to implement this protocol in rare circumstances, but UIViewControllerTransitionCoordinator implements…
GoldenJoe
  • 7,874
  • 7
  • 53
  • 92
4
votes
1 answer

How to show one of the two ViewControllers by tapping Cancel button?

I`ve one ViewController to which I can hit by clicking on TabBarItem or from Table View Controller B by pressing plus on navigation bar. My problem How, by clicking on the Cancel button on the ViewController, I can go to Table View Controller B if I…
4
votes
1 answer

Why does `viewWillAppear` set `animated` to true even when presenting with `present(_, animated: false, _)`?

So I present some view controller (loaded from xib) let popup = PopupViewController() popup.configure(withDataSource: dataSource) vc.present(popup, animated: false, completion: nil) As you can see, I ask to present it with no animation. However,…
nikans
  • 2,468
  • 1
  • 28
  • 35
4
votes
2 answers

Tab Bar not hiding using UIViewController

I am adding a UIViewController as PresentViewController using Tab Bar, then the view looks like: After selecting any option, I need to hide the Tab Bar, but my screen looks like: Kindly suggest me the solution for it. I am adding a view controller:…
4
votes
4 answers

Create a view controller outside of storyboard

I need a small tutorial video to our iOS project which can be accessed from multiple view controllers(screens). I don't want to break dozens of segues to add this tutorial, as it would cause a nightmare. Would the best way to do this, is to create a…
monekypox121
  • 93
  • 1
  • 8
4
votes
2 answers

iOS Looking to delay segue between view controllers when button is pressed

I am fairly new to swift and Objective C, and I have an app that goes from the main view controller to the second view controller on a button press. THe second view controller opens up a camera and every time I click the button there is somewhat of…
Veejay
  • 397
  • 3
  • 10
  • 17
4
votes
1 answer

Where to call becomeFirstResponder(), at ViewDidAppear or ViewWillAppear?

What I want: A textField and a textLabel is included in the tableView. When the tableView is present the textField will be the firstResponder and brings out the keyboard. Problems I have: the App is only shows the keyboard if the…
SLN
  • 4,772
  • 2
  • 38
  • 79
4
votes
7 answers

Pushing UIViewController to NavigationController does not actually push the view

I have this code in my table view controller (and delegate): - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { DetailStatus *detailViewController = [[DetailStatus alloc] initWithNibName:@"DetailStatus"…
Enrico Susatyo
  • 19,372
  • 18
  • 95
  • 156
4
votes
1 answer

UINavigationControllerDelegate method called twice

I have set up a very simple project with no storyboard, one window and one UINavigationController containing a plain old UIViewController as rootViewController. In the AppDelegate I've set the UINavigationController's delegate to self and…
4
votes
1 answer

Black view under navigation bar

In my app i have two view controllers embedded in navigation controller (lets say viewControllerA and viewControllerB). In the rootviewcontroller I don't want to show navigation bar, so in viewWillAppear and viewWillDisappear i have added thes…
Vah.Sah
  • 522
  • 1
  • 6
  • 21
4
votes
1 answer

performSegue - does it stop further code execution?

Does the call performSegue supposed to stop further code execution and pass execution to the target? I have this simple call : performSegue(withIdentifier: "showTweets", sender: self) But seems like the following code after that line is still…
Guy Z
  • 683
  • 3
  • 8
  • 24
4
votes
2 answers

iOS View Controller Shifts After Rotation

I am working on an iOS application. My app delegate loads my view controller onto the window and displays it correctly, except for one caveat: the views on my view controller are not down far enough on the Y-axis and the status bar clips my top…
groomsy
  • 4,945
  • 6
  • 29
  • 33
4
votes
2 answers

Loading custom UIView in UIViewController's main view

I have subclassed UIView and created a NIB that controls the main logic for my application. Hoping the view will scale nicely, I want to use it for both the iPhone and iPad versions of the app. On the iPhone the view will cover the full screen. On…
Beav
  • 495
  • 2
  • 5
  • 14
4
votes
2 answers

Custom transition in Swift 3 does not translate correctly

I've implemented a Navigation controller to incorporate an rotating-disc type of layout (imagine each VC laid out in a circle, that rotates as a whole, into view sequentially. The navigation controller is configured to use a custom transition class,…