viewcontroller

Single View Controller for multiple views

こ雲淡風輕ζ 提交于 2020-08-24 06:48:26
问题 I'm trying to make a registration form with multiple views but only one view controller. After proceeding to the next view I'm writing the input to a struct which will be sent to the server later on. The problem I'm facing is that the VC is reinitialized when entering the new view and therefore the user struct is reinitialized too. Is there any way to get around having multiple ViewControllers ? 回答1: If the only reason for using one view controller is so that you can persist your data across

Single View Controller for multiple views

喜欢而已 提交于 2020-08-24 06:48:17
问题 I'm trying to make a registration form with multiple views but only one view controller. After proceeding to the next view I'm writing the input to a struct which will be sent to the server later on. The problem I'm facing is that the VC is reinitialized when entering the new view and therefore the user struct is reinitialized too. Is there any way to get around having multiple ViewControllers ? 回答1: If the only reason for using one view controller is so that you can persist your data across

Set labels in a custom cell to names from an array using a separate controller

给你一囗甜甜゛ 提交于 2020-08-10 19:17:55
问题 I have a view controller with a table. The view controller has a button that segues to another controller with 4 textfields. There is a name textfield and three others where numbers can be inputed. When a user presses add, an array is appended and the view controller is dismissed while updating the table in the previous view controller. The user is then presented a table with a new cell added. The cell has 4 labels. I am trying to figure out how to set each label in a cell to the 4 textfields

“fatal error: unexpectedly found nil while unwrapping an Optional value” while calling a protocol method

三世轮回 提交于 2020-02-08 08:50:30
问题 I've implemented a protocol to get some sort of message, that a game has already finished and passes the time to my controller (Game wrote in SpriteKit). But now I'm having this fatal error after finishing the game and executing the gameEnded method and the app just crashes. Does anyone know why? Here is my code GameViewController class AcceleratorGameController: UIViewController { var time: Float = 0.0 var challengeController: ChallengeViewController! weak var delegate : GameEnded? override

viewWillAppear is not called in my view controller when the app becomes active

女生的网名这么多〃 提交于 2020-01-24 19:14:29
问题 Disclaimer: I'm an iOS noob. I created a view based app using Xcode's template that uploads pictures to a website. Xcode created AppDelegate.m (& .h) and ViewController.m as well as a storyboard for me automatically. The app is launched from a website using a URL schema, and I use that information in my view controller. I have two questions: 1) Is this a good way to pass query strings from my AppDelegate to the view controller? I have a NSDictionary property in my AppDelegate called

viewWillAppear is not called in my view controller when the app becomes active

隐身守侯 提交于 2020-01-24 19:14:23
问题 Disclaimer: I'm an iOS noob. I created a view based app using Xcode's template that uploads pictures to a website. Xcode created AppDelegate.m (& .h) and ViewController.m as well as a storyboard for me automatically. The app is launched from a website using a URL schema, and I use that information in my view controller. I have two questions: 1) Is this a good way to pass query strings from my AppDelegate to the view controller? I have a NSDictionary property in my AppDelegate called

viewWillAppear is not called in my view controller when the app becomes active

蹲街弑〆低调 提交于 2020-01-24 19:14:04
问题 Disclaimer: I'm an iOS noob. I created a view based app using Xcode's template that uploads pictures to a website. Xcode created AppDelegate.m (& .h) and ViewController.m as well as a storyboard for me automatically. The app is launched from a website using a URL schema, and I use that information in my view controller. I have two questions: 1) Is this a good way to pass query strings from my AppDelegate to the view controller? I have a NSDictionary property in my AppDelegate called

Passing data from view controller to tab bar controller in iOS

℡╲_俬逩灬. 提交于 2020-01-22 12:17:44
问题 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

Passing data from view controller to tab bar controller in iOS

可紊 提交于 2020-01-22 12:15:14
问题 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