以编程方式创建segue我有个共同点UIViewController我所有的UIViewsControllers扩展到重用一些常见操作。我想在这个“公共”上建立一个UIViewController所以其他人UIViewControllers继承。我正在努力弄清楚如何通过编程来实现这个目标。我想问题也可能是如何设置segue为了我UIViewControllers而不是走进故事板用手做的。
3 回答
慕工程0101907
TA贡献1887条经验 获得超5个赞
UIBarButtonItem *buttonizeButton = [[UIBarButtonItem alloc] initWithTitle:@"Buttonize" style:UIBarButtonItemStyleDone target:self action:@selector(buttonizeButtonTap:)];self.navigationItem.rightBarButtonItems = @[buttonizeButton];
-(void)buttonizeButtonTap:(id)sender{ [self performSegueWithIdentifier:@"Associate" sender:sender]; }
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if ([[segue identifier] isEqualToString:@"Associate"]) { TranslationQuizAssociateVC *translationQuizAssociateVC = [segue destinationViewController]; translationQuizAssociateVC.nodeID = self.nodeID; //--pass nodeID from ViewNodeViewController translationQuizAssociateVC.contentID = self.contentID; translationQuizAssociateVC.index = self.index; translationQuizAssociateVC.content = self.content; }}
斯蒂芬大帝
TA贡献1827条经验 获得超8个赞
UIViewController *toViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"OtherViewControllerId"]; MyCustomSegue *segue = [[MyCustomSegue alloc] initWithIdentifier:@"" source:self destination:toViewController]; [self prepareForSegue:segue sender:sender];[segue perform];
- 3 回答
- 0 关注
- 566 浏览
添加回答
举报
0/150
提交
取消