viewcontroller

Update Text in While Loop Swift

两盒软妹~` 提交于 2019-12-02 09:03:47
My program has a while-loop that runs some code, generating various text statements as it goes along. The problem is that the UILabel only prints the last line of text in the series (my understanding is because it iterates too quickly). How do I get the label to print all of the text encountered, like one would see in console output? I looked at this link but the example doesn't seem to match my situation and not sure how to implement the fix (if that's even the right one): Update Label In While Loop Swift class ViewController: UIViewController { var locationArray = ["Place A", "Place B",

Same view controller loads twice

浪子不回头ぞ 提交于 2019-12-02 05:46:52
I've read several posts on this issue but none of them solved my problem. I'm coding an app where I have to click on a button ("Prepare") to go to the following ViewController. When the button is clicked, it also passes data between the two view controller. The problem is, when I click the button, the following ViewController loads twice. Thus, if I want to go back I have to go back through two same ViewController. I've checked the segue, the class names and files names but nothing fixes it. I've also created a new project and rewritten all the code from the beginning but in the end, it still

ViewDidAppear not called when the modal view is dismissed

跟風遠走 提交于 2019-12-01 15:54:49
First, I create a MainViewController. Then in MainViewController, I do [self presentViewController:modalViewController animated:YES completion:nil]; modalViewController.modalPresentationStyle = UIModalPresentationFormSheet; When I dismiss the modalViewController, On iPhones(except iPhone 6+), viewDidAppear of MainViewController is called. On iPads and iPhone 6+, viewDidAppear of MainViewController is not called. The logic is to called a function when the modalViewController is dismissed. How can I know when the modalViewController is dismissed. You can use a delegate to call your function in

Cannot call value of non-function type 'String'

只愿长相守 提交于 2019-12-01 15:40:22
I'm trying to pass the ILTItem variable into my ILTViewController, triggered by AppDelegate.swift when the user launches my app via a deeplink. The code I have errors with: Cannot call value of non-function type 'String' on the line where I define ilt . Here's the code I have at the moment: let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate var ilt = ILT(homeworkID: 1234, title: "History ILT", subject: "History", teacher: "Miss A Smith", teacherCode: "asmith", studentID: 12345, description: "Description....", due: 1450137600, status: "In Progress", hasAttachments:

ViewDidAppear not called when the modal view is dismissed

て烟熏妆下的殇ゞ 提交于 2019-12-01 15:34:32
问题 First, I create a MainViewController. Then in MainViewController, I do [self presentViewController:modalViewController animated:YES completion:nil]; modalViewController.modalPresentationStyle = UIModalPresentationFormSheet; When I dismiss the modalViewController, On iPhones(except iPhone 6+), viewDidAppear of MainViewController is called. On iPads and iPhone 6+, viewDidAppear of MainViewController is not called. The logic is to called a function when the modalViewController is dismissed. How

loading url from scheme not processing first time - appdelegate vs viewcontroller

旧街凉风 提交于 2019-12-01 13:30:46
问题 My app is successfully opening and setting the parameters (from URL-scheme i.e. myApp://sometextToPrint) to a variable in the AppDelegate class but whenever I want to process them it fails at the first time when the app is opened from that URL. I have the app in foreground checker that calls the function for printing the parameters given, but somehow it looks like the AppDelegate is loaded later than the view why the view fails to print the parameters at first load. My code looks as follow:

Stop NSTimer and dismiss view controller (swift)

强颜欢笑 提交于 2019-12-01 12:04:21
I am using NSTimer to look for updates in my firebase database. I have put the code inside my viewDidLoad() . NSTimer.scheduledTimerWithTimeInterval(5.0, target: self, selector: #selector(DriversInterfaceViewController.CheckFormularChild), userInfo: nil, repeats: true) When the user has received a file in the database I want the user to goto another ViewController . The problem is that either the old ViewController is running in the background or the timer does not stop when changing View Controller . let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil) let nextViewController

How to move to First viewController from last View controller among multiple view controllers

北城以北 提交于 2019-12-01 12:02:42
Hii...i am new to iPhone programming..can anybody help me out please...!! I have multiple viewControllers..in First ViewController called HomeViewController i called the method [self presentModalViewController:aboutViewController animated:YES]; in a IBAction for aboutButton to move to AboutViewController and in the AboutViewController i called the method [self presentModalViewController:ContactUsViewController animated:YES]; to move to that view controller and one more method [self dismissModalViewControllerAnimated:YES]; to go back to HomeViewController. in the 3rd, ContactUSViewController i

What is the best way to restore the state of ViewController

别来无恙 提交于 2019-12-01 11:41:48
I would like to ask some suggestion about how to restore a viewControllers state. Like in the app called "Pic Collage" when you create a card and save it and later restore it. If you really want to learn about state preservation, see WWDC 2012 video, Saving and Restoring Application State on iOS . But, it's also just as likely that the app in question is simply saving the model data (the object model that represents this card) in persistent storage, and when the app re-starts, it simply loads that model data again. There are a whole bunch of possible technologies for persistent storage ranging

How to move to First viewController from last View controller among multiple view controllers

↘锁芯ラ 提交于 2019-12-01 11:40:28
问题 Hii...i am new to iPhone programming..can anybody help me out please...!! I have multiple viewControllers..in First ViewController called HomeViewController i called the method [self presentModalViewController:aboutViewController animated:YES]; in a IBAction for aboutButton to move to AboutViewController and in the AboutViewController i called the method [self presentModalViewController:ContactUsViewController animated:YES]; to move to that view controller and one more method [self