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
34
votes
3 answers

iOS8 Interface Rotation Methods not called

Since willAnimateRotationToInterfaceOrientation:duration: is deprecated in iOS8, one needs to use viewWillTransitionToSize:withTransitionCoordinator: instead. However, this method does not get called in my view controller on iOS8. Is there anything…
tschubotz
  • 343
  • 1
  • 3
  • 6
34
votes
2 answers

Difference between a custom UIStoryboardSegue and UIViewController transition

I am trying to find out what the difference is between a custom UIStoryboardSegue and a custom UIViewcontroller transition (introduced in ios7). What are the differences and different use cases for both? As far as I can tell they are both used for…
StuartM
  • 6,743
  • 18
  • 84
  • 160
34
votes
8 answers

Remembering scroll position on UITableView

I have a bit of a problem with my iOS app in xcode. I have a UITableView that loads a few hundred cells. When I scroll down to a specific cell and drill down to detailedviewcontrollers and return again the master view table has returned all the way…
mylogon
  • 2,772
  • 2
  • 28
  • 42
33
votes
2 answers

Unified UIViewController "became frontmost" detection?

In my mind, these situations are all parallel: My view controller presented another view controller fullscreen, which has now been dismissed My view controller presented another view controller not fullscreen, which has now been dismissed My view…
matt
  • 515,959
  • 87
  • 875
  • 1,141
33
votes
2 answers

How do I transition/animate color of UINavigationBar?

I have been searching for how to transition/animate the barTintColor of a UINavigationBar for a while now, and I only see different answers. Some use UIView.animateWithDuration, some use CATransition, but the most interesting ones, like this one use…
Sti
  • 8,275
  • 9
  • 62
  • 124
33
votes
9 answers

How to maintain presenting view controller's orientation when dismissing modal view controller?

I have this app I am working on and I need ALL my view controllers but one to be in portrait. The single one view controller that is special I need it to be able to rotate to whatever orientation the phone is in. To do that I present it modally (not…
Mihai Fratu
  • 7,579
  • 2
  • 37
  • 63
33
votes
4 answers

How to use Auto Layout with container transitions?

How can you use Auto Layout with the UIViewController container transition method: -(void)transitionFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController …
Mike Vosseller
  • 4,097
  • 5
  • 26
  • 28
33
votes
3 answers

How to set UIViewController "extend edges" properties

I see the following selections in Storyboard for extending the edges of a UIViewController's view under navBars/tabBars: But how do I set these properties globally for all of my ViewControllers in code? As opposed to manually checking/unchecking on…
hgwhittle
  • 9,316
  • 6
  • 48
  • 60
33
votes
6 answers

ios 7 UiView frame issue

I am running same app in iOS6 and iOS7 which has NavigationBar.It runs well on iOS6, but in iOS7, all view is little bit up like it is not considering the Navigation bar at all. I have tried changing topbar property in simulated metrics option but…
PK86
  • 1,218
  • 2
  • 14
  • 25
33
votes
9 answers

UIViewController viewWillAppear not called when adding as subView

I have a UIViewController that I am loading from inside another view controller and then adding its view to a UIScrollView. self.statisticsController = [self.storyboard…
Fogmeister
  • 76,236
  • 42
  • 207
  • 306
33
votes
7 answers

Proper way to hide status bar on iOS, with animation and resizing root view

Consider a view controller that needs to slide out (or hide) the status bar when a button is clicked. - (void) buttonClick:(id)sender { [[UIApplication sharedApplication] setStatusBarHidden:YES …
hpique
  • 119,096
  • 131
  • 338
  • 476
33
votes
8 answers

NSInvalidArgumentException - receiver has no segue with identifier

I have been trying everything for hours, and nothing's worked. I am trying to segue between two view controllers, from one tableViewController to another tableViewController. The segue is hooked up to the top level view, not the tableviewcell. The…
32
votes
8 answers

pushviewcontroller animation is slow/choppy

I push a ViewController which contains not too many views, UIScrollView which contains 10 views inside, I have a singleton ViewController and push it again and again without releasing and allocation again the ViewController, so all the things I do…
32
votes
1 answer

Am I abusing UIViewController Subclassing?

In trying to figure out why viewWillAppear wasn't being called in my app I came across what may be a gross misunderstanding I hold about the intended use of UIViewController subclasses. According to the following post viewWillAppear does not run…
averydev
  • 5,717
  • 2
  • 35
  • 35
32
votes
4 answers

In Call Status Bar (Unable to Satisfy Constraints)

Just like this question: Auto Layout and in-call status bar and this question: Resize for in-call status bar?, I am having issues with the In Call Status Bar screwing up my view layout. Here is my nested structure. I have a Custom Modal…
Will Hua
  • 1,729
  • 2
  • 23
  • 33