Note that there are some explanatory texts on larger screens.

plurals
  1. POSegues initiated directly from view controllers warning in storyboard xcode
    primarykey
    data
    text
    <p>Hi I have created button programmatically and I connected it to another view, but I got segue warning</p> <p>that I should use <code>prepareForSegue</code> method for storyboard but I don't know how, there are some sample on Internet but I get an error when I used that sample, would you please help me</p> <p>here is my code</p> <p><strong>Creating Button</strong></p> <pre><code> UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; button.backgroundColor=[UIColor colorWithRed: 201.0/255.0 green: 201.0/255.0 blue:201.0/255.0 alpha: 1.0]; button.tag = currentTag; currentTag++; [button.layer setBorderColor: [[UIColor blackColor] CGColor]]; [button.layer setBorderWidth: 1.0]; [button setTitle:[NSString stringWithFormat:@"%d",currentTag] forState:UIControlStateNormal]; button.frame = CGRectMake(80*x, 32*y, 80, 32); [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; [buttonView addSubview: button]; </code></pre> <p><strong>Action for button</strong></p> <pre><code>-(void)buttonPressed:(UIButton *)button { NSLog(@"button %u -- frame: %@", button.tag, NSStringFromCGRect(button.frame)); [self performSegueWithIdentifier:@"WeekView" sender:self]; } </code></pre> <p><strong>Prepare for segue</strong> <strong>MY Warning</strong></p> <p><strong>Segues initiated directly from view controllers must have an identifier for use with -[UIViewController performSegueWithIdentifier:sender:]</strong></p> <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"WeekView"]) { [segue.destinationViewController setTitle:@"WeekView"]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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