iOS: Storyboard Segue

。_饼干妹妹 提交于 2019-12-08 10:04:23

问题


Currently I am working for an IPad application which shows a Slideshow on the first scene - realized with a paged UIScrollView. When I click on one page in the slideshow I want to push a new VC (to a new scene, which should present multiple thumbnails... a kind of detail layer if you want so).

How can I do this via segue? Currently I simply pulled out a new VC and connected the SlideshowVC with the the next VC in the scene - but nothing happens. I wrapped my head around a couple of tutorials but most of them use a button which is connected to the next VC. Is it able to simply connect the SlideshowVC with the next VC or do I really need to strap a button over the whole scrollview and connect the button with the next VC?

Currently my scene look like the following picture. The first one is a NavVC - the second the SlidehsowVC and the third the DetailVC.


回答1:


If you don't want to connect the segue to a button, when you intercept the user interaction, just do this -

[self performSegueWithIdentifier:@"mySegueIdentifier" sender:self];

If you need to set anything up before you get there, use this -

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([[segue identifier] isEqualToString:@"mySegueIdentifier"]) {
        MyViewController *myViewController = segue.destinationViewController;
        // do something here
    }
}


来源:https://stackoverflow.com/questions/12156441/ios-storyboard-segue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!