Note that there are some explanatory texts on larger screens.

plurals
  1. POPass Value in iOS
    primarykey
    data
    text
    <p>I created two pages, called ViewController and SecViewController. In ViewController, which is the first page, with one button and one label. And I set segue on a button to SecViewController, which is the second page. </p> <p>I am trying to pass the segue identifier to page 2, but this is not success. I test the value passing in page1, the console display </p> <blockquote> <p>2013-07-05 10:33:54.554 Testing2[1314:c07] 1, (null)</p> </blockquote> <p>Here is my code: Anyone can identify which code I typing wrong?</p> <p>ViewController.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @class SecViewController; @interface ViewController : UIViewController @property (strong, nonatomic) IBOutlet UILabel *label; @property (strong, nonatomic) IBOutlet UIButton *button; @property (strong, nonatomic) SecViewController *view2; @end </code></pre> <p>ViewController.m</p> <pre><code>#import "ViewController.h" #import "SecViewController.h" @implementation ViewController @synthesize label, button, view2; - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if ([[segue identifier] isEqualToString:@"1"]){ view2.received = [segue identifier]; NSLog(@"%@, %@", [segue identifier], view2.received); } } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [label setText:@"Game Start!"]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end </code></pre> <p>SecViewController.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface SecViewController : UIViewController @property (strong, nonatomic) id received; @property (strong, nonatomic) IBOutlet UILabel *label; @end </code></pre> <p>SecViewController.m</p> <pre><code>#import "SecViewController.h" @implementation SecViewController @synthesize label; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload