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:

16111 questions
4
votes
0 answers

Is there a way to use the new UIPresentationController with push/pop transitions, not just modal?

It seems all the docs I've read refer to using the new UIPresentationController with modal presentations, but none refer to UINavigationController-based push/pop transitions. Are these possible with iOS 8, if so, how do I present them?
4
votes
2 answers

Attempt to present GKGameCenterViewController on UIViewController whose view is not in the window hierarchy

I am having troubles showing the Game Center leaderboard when the user presses a button on my SecondViewController (game over screen with score/top score). The UIbutton is ShowLeaderboard which you'll see below. The error I get is: Warning: Attempt…
DanTdd
  • 322
  • 3
  • 10
4
votes
1 answer

Swift - Pushing ViewController in gives a black screen

So I have one View Controller that holds a tableView. Whenever a tableview cell is clicked, another view controller is pushed in. This new view controller has its own xib. file and swift file. I have a mapview in the new viewcontroller, but the new…
dhruvm
  • 2,314
  • 2
  • 14
  • 22
4
votes
2 answers

Passing an managedObjectContext from one ViewController to another ViewController in Swift?

My current project is a Core Data project in Swift that creates notes. I'm trying to set the managedObjectContext of my destinationVC from the currentVC in prepareForSegue and I am trying to figure out how to do that in Swift. I've used Apple's…
Adrian
  • 14,925
  • 16
  • 92
  • 163
4
votes
1 answer

Load ViewController Swift - Black Screen

Im trying to simply load a new ViewController and its associated xib when a button is clicked, but the screen becomes black after the new view is loaded. When the button is clicked the following method is called: let vc = MainViewController() …
raisedandglazed
  • 724
  • 10
  • 28
4
votes
3 answers

Popping UIView crashes app

I'm basically pushing a UIView from a UITableViewController and all it contains is a UIWebView. However when I remove the UIView to return back to the UITableView the app crashes. - (void)tableView:(UITableView *)tableView…
Adun
  • 71
  • 4
4
votes
1 answer

iOS Swift: UIViewControllerAnimatedTransitioning end frame in wrong position

I have a Swift project, learning a weather API and also trying to get a better handle on the AnimatedTransitions. I have a UITableView using a custom UITableViewCell with images and text. Tapping a cell in the tableView transitions to a new…
Nate Birkholz
  • 2,509
  • 4
  • 17
  • 28
4
votes
4 answers

How to know current interfaceOrientation in iOS 8?

Now that interfaceOrientation propery in UIViewController is deprecated, what is the recommended way to detect current device orientation?
cocoapriest
  • 1,820
  • 3
  • 21
  • 36
4
votes
1 answer

View debugging - UITransitionViews - Xcode

I have some menus in my app wich are all presented modally. In my tests I noticed that the more often I switch between menus the more UITransitionViews are show in the View Debugging Window in Xcode when i capture the View Hierarchy. Is this a…
Johannes
  • 318
  • 3
  • 13
4
votes
1 answer

Unbalanced calls to UIViewController when asking for HealthKit permissions

I ask my user for permission to HealthKit by allowing the user to click a button 'Connect to Health App'. This calls the [HKStore requestAuthorizationToShareTypes:...] function which will ultimately present a view controller modally for the…
BYZZav
  • 1,344
  • 17
  • 30
4
votes
1 answer

How do I access my viewController from my appDelegate? (Swift)

I am in my AppDelegate and I need to refresh the webview placed in my ViewController. So I've googled how to call a method/variable from appDelegate and I found this: MyViewController* mainController = (MyViewController*) …
4
votes
1 answer

Changing VC issue in Swift. How to pass data between views in tab bar controller?

I have four ViewController, I don't use an UITabbedbar because It's more difficult to customize. I use modal segue but I think the memory consumption is excessive. this is a screen shot of my first and second VC. What I have to use to change View…
user4385051
4
votes
4 answers

Dismiss and Pop a view controller

I want to go back two levels on my view controller stack. I have three segues in this order: Show, Show, Present Modally. There is a navigation controller in use. From my 4th view I want to go back to the 2nd view. I have tried using …
Ricca
  • 196
  • 1
  • 19
4
votes
1 answer

Calling Swift from JavaScript

I am new to Swift/iOS and have been working on an app that calls Swift code from JavaScript. There are not as many tutorials online and a lot of them are from when Swift was still in beta. Anyway, I was getting an error on my code and I am unable to…
Dimitar Dyankov
  • 199
  • 1
  • 2
  • 10
4
votes
0 answers

Not able to assign custom viewcontroller in storyboard

I am absolutely clueless what happened to Xcode. I'm not even able to assign a custom ViewController to a storyboard ViewController. I get the error: "Unknown class vcTest in Interface Builder file........... this class is not key value…
Johannes
  • 318
  • 3
  • 13
1 2 3
99
100