viewcontroller

Difference between a Scene and a View in iOS

只愿长相守 提交于 2019-12-03 11:58:29
问题 I'm new to iOS I'm having trouble understanding the difference between scene and a view. Unfortunately Apple's documentation isn't helping me. I read that a scene is what you see on the screen. But isn't that what a view is? Are these two interchangeable terms? If not what are the differences, both functionality and best practice? How does a ViewController come into play for both of these? Any explanations or links are much appreciated. 回答1: In simple terms: View A UIView is a rectangular

Difference between presentModalViewController and presentViewController?

别等时光非礼了梦想. 提交于 2019-12-03 11:45:14
问题 In iOS 5 SDK, there're two methods of UIViewController, presentModalViewController:animated: and presentViewController:animated:completion:. What's the difference between these two method? The documentation says: The presentViewController:animated:completion: method is the preferred way to present a modal view as of iOS 5.0. If I use a presentModalViewController:animated in iOS 5, will it causes a bug? Are they functionally-same? 回答1: They seem to do the same thing as apple documentation

dismissViewController: not working

守給你的承諾、 提交于 2019-12-03 10:05:26
问题 I have a view controller called vc0 which is presented like this: [self presentViewController: vc1 animated: YES completion: nil]; And in vc1 I have a button to present another view controller: [self presentViewController: vc2 animated: YES completion: nil]; Then in vc2, I have a button to dismiss the view controller: [self dismissViewControllerAnimated:YES completion: ^{ // over here I call one method in vc1 } And as expected it returns back to vc1.. however there is a button in vc1 to go

Understanding View Controller Nesting in iOS

独自空忆成欢 提交于 2019-12-03 08:46:28
问题 Ive been tearing my hair out over the last couple of days trying to understand this one seemingly basic concept of iOS development: If I want to have two or more View Controllers displayed and usable in the same "screenful", is this: Not advisable as per Apple's "One VC per screenful of content" Completely possible by adding the VC's via code Just not done. Instead, use one VC and simply add code that mimics the functionality of the view controllers you want. Let me rephrase a bit: If I

Deleted class drops error message unknown>:0: error: no such file or directory:

﹥>﹥吖頭↗ 提交于 2019-12-03 08:39:56
问题 So me and some friends working on a bitbucket project and already realized that bitbucket sometimes doesn't sync all the files. But here is what happened: I continued working and created an class, I basically copied an old View Controller (called WelcomescreenViewController.swift -> CreateAccountViewController.swift ) and made some adjustments in the main storyboard. Here I deleted all the old outlets in the new one and then made an own class for it as ViewController and connected it with it

A view controller is in landscape mode, but I'm getting the frame from portrait mode?

北战南征 提交于 2019-12-03 08:31:42
I have a settings view controller with a table view. The table view is supposed to set its frame to be the frame of the view controller. My app only supports landscape mode, so that's the orientation I'm always in. However, when the settings view controller loads, the table view has the portrait mode frame of the view controller, even though it's in landscape (360 by 480 when it should be 480 by 360). Additionally, when I checked to see if the device thought it was in portrait mode, it returned true. What is causing the problem and how can I fix it? when you call [UIView init] it will default

Show ViewController from XIB-file-Button - Swift

五迷三道 提交于 2019-12-03 08:23:30
is there a way how to segue from a xib-file (custom TableViewCell) to another ViewController in the Main.storyboard. There's no possibility to drag a segue, like within the main storyboard. In the cell I've got a button, from where I want to change the view. How can I solve it? Thanks! You can always instantiate a view controller from your Storyboard and present it on button tapped: let storyboard = UIStoryboard(name: "Main", bundle: nil) let vc = storyboard.instantiateViewControllerWithIdentifier("ViewControllerID") as UIViewController self.presentViewController(vc, animated: true, completion

ios - Navigation between multiple NavigationControllers

馋奶兔 提交于 2019-12-03 06:58:08
I'm trying to understand a behavior of navigating between ViewControllers with (and without) using a NavigationController and I'm misunderstanding some things while reading articles and docs so I decided to ask them. Main question is: What happened if we have multiple NavigationControllers in Storyboard and want to go from one to another? (And this can be achieved just using segues as we do between common VCs, am I right?) As I understand, a NavigationController represents a stack of ViewControllers within which we can pop and push these VCs. So now we change our "location" from VCs of the

Passing data from view controller to tab bar controller in iOS

余生颓废 提交于 2019-12-03 06:55:03
I'm developing an iOS app and now I'm at a loss. I'm trying to pass data from the first View Controller to the first tab of a TabBarViewController (with using the storyboard). I found a lot of tutorials that explain how to pass data between view controllers, but nothing worked with my tab bar. I know that the tab bar controller contains a kind of array of views. The relation between the View Controller and the Tab Bar Controller is realized using a segue (push). So, I thought it is easy to use the prepareForSegue() - method. Like that: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:

Presenting a view controller programmatically in swift

隐身守侯 提交于 2019-12-03 06:39:06
Hi I am trying to convert the following objective C code into swift to navigate from one view controller to another view controller when a button is clicked. any help would be much appreciated This is taken from apple's programming guide - (void)add:(id)sender { // Create the root view controller for the navigation controller // The new view controller configures a Cancel and Done button for the // navigation bar. RecipeAddViewController *addController = [[RecipeAddViewController alloc] init]; // Configure the RecipeAddViewController. In this case, it reports any // changes to a custom