Perform segue from button in XIB

梦想与她 提交于 2019-12-12 10:02:52

问题


I'm using storyboards for the most of my project, but i have one UIScrollView that consists of multiple views that are loaded from XIB

I'm stuck on how to perform a segue when a button is clicked in the XIB

What i've done already.

  • Added the views to a scroll view
  • Added a custom button
  • added an IBAcion on the custom button

MainViewController

NSString *nibName = @"coverArticleView";
NSArray *nibObjects = [NSBundle.mainBundle loadNibNamed:nibName owner:self options:nil];
coverArticle *pageView = [nibObjects objectAtIndex:0];
pageView.articleTitle.text = ob.Title;
pageView.articleTitle.numberOfLines =0;
// updating some more properties here & designing the scroll view
[coverArticlesScrollView addSubview:pageView];

coverArticle.m (class of the XIB)

- (IBAction)buttonPressed:(id)sender {
NSLog(@"button pressed");
}

When the log 'button pressed' is printed so that's working. But how do i perform a segue when the button is pressed ?

thnx


回答1:


How about performSegueWithIdentifier:sender:?



来源:https://stackoverflow.com/questions/11259199/perform-segue-from-button-in-xib

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