ios - How to pass two parameters to the next ViewController? -


This is my position. I'm using NSTimer, which calculates 15 seconds but I also have a button, Which I want to stop this timer first And this button takes me to the next table ViewController. The second parameter is the date - the current time in the center European. If I click on a button, then I need to go to the next tableview controller, and put two parameters to control this table value. This is my code:

  ** FirstViewController: ** importing UIKit class FirstViewController: UIViewController {var timer = NSTimer () @IBOutlet weak bridesmaid labelCounter: UILabel! ViewDidLoad () override {super.viewDidLoad (function) timer = NSTimer.scheduledTimerWithTimeInterval (: self selector: 1, target selector ( "Update"), userInfo: repeats zero, true)} function Update () {timer. invalidate ()} function override prepareForSegue (segue: UIStoryboardSegue!, this :! AnyObject) {if (segue.identifier == "segueTest") {var transfer = segue .destinationViewController as SecondViewController transfer.toPass = labelCounter.text transfer.toPass2 = "\ (NSDate ())"}} @Ubouting Funk button pressed (button: UIButton) {if labelCounter.text & gt; "0" {timer.invalidate ()} Second View Controller: Import UIKit Class III Visual Controller: UIViewController {@Iboutlet weak variant label 1: UILabel! @ IBOutlet weak var label 2: UILBL! Var toPass: String! Var toPass2: String! Override funk viewDidload () {super.viewDidLoad () label 1.text = toPass2 label2.text = toPass // Make an additional setup after loading the view. } Override Funk Receive Memory Warning () {super.didReceiveMemoryWarning () // Dispose of any resource that can be reproduced. }  

This code works fine :) In the storyboard I had to connect the first viewer with the second view controller. I think that was connected by my buttons with secondViewController and segue identifier "segueTest"

I don No installation is not aware that it is useful or you

BViewControl.h

  @interface Showdeals: UIViewController {NSString * TotalJSonString; NSString * passing string; NSMutablearray * setarray; } @ Property (strong, non-constructive) NSString * TotalJSonString; @protty (strong, non-constructive) NSString * passing string;  

BViewControl.m

  - (zero) viewDidLoad {[setarray addObject: TotalJSonString]; [Ceterre adobect: passing string]; }  

Finally you passarray to UITableView pass

button action AViewControl.m

  BViewControl * show = [[BViewControl Alloc] InitWithNibName: zero bundle: zero]; [Show show model transition style: Uomodal transition style flip horizontal]; ShowJesonString = string1; Show.PassingString = string2; [Self. Navigation controller popToRootViewController estimate: TRUE]; [Self-present ViewController: Animated Show: Yes Completed: Zero];  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -