how to perform a segue

I would like implement a button to show another view. I have defined the destination ViewController in Storyboard & created a segue (of type push) and gave it an identifier.

In my root view controller

some method ...

        UIButton *btn = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [btn addTarget:self action:@selector(showDetailView:) forControlEvents:UIControlEventTouchUpInside];

and

- (IBAction)showDetailView:(id)sender {
    [self performSegueWithIdentifier:@"ShowDetail" sender:sender];
}

however it doesn't do anything. I hear a Segue is an object. do I need to have a reference to it / synthesize it in my root view controller class? Any tip would be appreciated. Thank you.


Edit:
Make sure your root view controller is embedded in a navigation controller. if it isn't, select your view controller in the storyboard designer and choose Editor->Embed In->Navigation Controller in the menu.

Original:
Double-check the Identifier (storyboard-code) and try setting sender to self . If that doesn't work you can create a Segue object yourself in code.

链接地址: http://www.djcxy.com/p/61270.html

上一篇: 我如何在Xcode中调试TableViewCell的segue?

下一篇: 如何执行赛格