Moving to another view controller in iOS on Button Click

后端 未结 2 2177
小蘑菇
小蘑菇 2021-02-19 23:15

I am very new to iOS and I am still trying to grasp things. I am trying out this simple program in XCode 5 where when a user clicks the button, he will be redirected into anothe

相关标签:
2条回答
  • 2021-02-19 23:48

    You know, using a storyboard you can also define a segue that isn't connected directly to a button, name that segue, and then call it programatically like so:

     [self performSegueWithIdentifier:@"showWebServiceViewController" sender:nil];
    

    I think this approach is cleaner and more in line with the storyboard way of working.

    Of course, depending on which user has logged in you could perform different named segues to get to the approporiate screen.

    0 讨论(0)
  • 2021-02-19 23:51

    try this:

    WebServiceViewController *wc = [[UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:@"WebServiceViewController"];
    

    also set storyboardId to WebServiceViewController in Identity Inspector

    0 讨论(0)
提交回复
热议问题