以編程方式創建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 關注
- 600 瀏覽
添加回答
舉報
0/150
提交
取消