viewcontroller

Stop NSTimer and dismiss view controller (swift)

左心房为你撑大大i 提交于 2019-12-01 10:49:18
问题 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

How do I segue values when my ViewController is embedded in an UINavigationController?

柔情痞子 提交于 2019-12-01 10:39:58
I have two view controllers that send values back and forth via segues and the prepareForSegue method. This has been working out perfectly for me until I decided to embed my ViewController inside a Navigation Controller. If you look at the method below you can see the problem is that my destinationViewController is no longer ViewController... its my newly created UINavigationController. TimeViewController.swift (secondary controller) override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { var dest = segue.destinationViewController as! ViewController var min =

Passing data between views in ONE ViewController in Swift

為{幸葍}努か 提交于 2019-12-01 10:34:21
All of the searches I've done focus on passing data between view controllers. That's not really what I'm trying to do. I have a ViewController that has multiple Views in it. The ViewController has a slider which works fine: var throttleSetting = Float() @IBAction func changeThrottleSetting(sender: UISlider) { throttleSetting = sender.value } Then, in one of the Views contained in that same ViewController, I have a basic line that (for now) sets an initial value which is used later in the DrawRect portion of the code: var RPMPointerAngle: CGFloat { var angle: CGFloat = 2.0 return angle } What I

What is the best way to restore the state of ViewController

余生长醉 提交于 2019-12-01 09:45:18
问题 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. 回答1: 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

Dismissing 2 ViewController consecutively

烂漫一生 提交于 2019-12-01 07:37:23
I try 2 ways to dismissed 2 viewcontrollers consecutively but only one of them got dismissed not the second one method1 -(void) LoginDone:(NSNotification *)notif { [self dismissViewControllerAnimated:YES completion:NULL]; //previous viewcontroller [self dismissViewControllerAnimated:YES completion:NULL]; //current viewcontroller } method2 -(void) LoginDone:(NSNotification *)notif { [self dismissViewControllerAnimated:YES completion:NULL]; [[NSNotificationCenter defaultCenter] postNotificationName:@"LoginDone2" object:nil]; } -(void) LoginDone2:(NSNotification *)notif { [self

How do I segue values when my ViewController is embedded in an UINavigationController?

百般思念 提交于 2019-12-01 07:32:44
问题 I have two view controllers that send values back and forth via segues and the prepareForSegue method. This has been working out perfectly for me until I decided to embed my ViewController inside a Navigation Controller. If you look at the method below you can see the problem is that my destinationViewController is no longer ViewController... its my newly created UINavigationController. TimeViewController.swift (secondary controller) override func prepareForSegue(segue: UIStoryboardSegue,

UIModalTransitionStylePartialCurl half page

岁酱吖の 提交于 2019-12-01 06:28:04
I'm displaying an UIViewController by the following way: MyViewController *myVc = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; [myVc setModalTransitionStyle:UIModalTransitionStylePartialCurl]; [self presentModalViewController:myVc animated:YES]; If I'm drawing the MyViewController 's view the transition affect only half a page (What I do want). In my case I'm drawing the entire MyViewController 's view so the transition takes affect at the entire view If I'm drawing only half a view the transition takes affect on half of the screen but I still have 'dead area'

Dismissing 2 ViewController consecutively

旧时模样 提交于 2019-12-01 05:04:34
问题 I try 2 ways to dismissed 2 viewcontrollers consecutively but only one of them got dismissed not the second one method1 -(void) LoginDone:(NSNotification *)notif { [self dismissViewControllerAnimated:YES completion:NULL]; //previous viewcontroller [self dismissViewControllerAnimated:YES completion:NULL]; //current viewcontroller } method2 -(void) LoginDone:(NSNotification *)notif { [self dismissViewControllerAnimated:YES completion:NULL]; [[NSNotificationCenter defaultCenter]

dismiss share extension custom viewcontroller

我的未来我决定 提交于 2019-12-01 04:26:31
I am trying to create a custom view controller to be used with a share extension. Everything works, but I don't know how to dismiss the custom view controller. Basically I launch my share extension from safari and want to completely dismiss this and return back to the safari view. I know this should not be hard, but I am new to share extensions. Below is my base code. Thanks. Bob // // ShareViewController.swift // ShareExtension import UIKit import Social import MobileCoreServices class ShareViewController: UIViewController { private var url: NSURL? @IBAction func backButton(_ sender: Any) {

UIModalTransitionStylePartialCurl half page

筅森魡賤 提交于 2019-12-01 04:09:56
问题 I'm displaying an UIViewController by the following way: MyViewController *myVc = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; [myVc setModalTransitionStyle:UIModalTransitionStylePartialCurl]; [self presentModalViewController:myVc animated:YES]; If I'm drawing the MyViewController 's view the transition affect only half a page (What I do want). In my case I'm drawing the entire MyViewController 's view so the transition takes affect at the entire view If I'm