【问题标题】:Perform segue from button in XIB从XIB中的按钮执行segue
【发布时间】:2012-06-30 19:58:43
【问题描述】:

我的大部分项目都使用故事板,但我有一个 UIScrollView,它包含从 XIB 加载的多个视图

我不知道如何在 XIB 中单击按钮时执行转场

我已经做了什么。

  • 将视图添加到滚动视图中
  • 添加了自定义按钮
  • 在自定义按钮上添加了一个 IBAcion

主视图控制器

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(XIB 类)

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

当日志“按下按钮”被打印出来时,它就可以工作了。 但是当按钮被按下时我如何执行 segue 呢?

thnx

【问题讨论】:

    标签: xcode ios5 xib segue


    【解决方案1】:

    【讨论】:

    • performSegueWithIdentifier 在“coverArticle”类中不可用
    猜你喜欢
    • 2016-06-05
    • 1970-01-01
    • 2015-01-08
    • 1970-01-01
    • 1970-01-01
    • 2013-07-17
    • 1970-01-01
    • 2019-03-17
    • 2015-09-28
    相关资源
    最近更新 更多