Interface Builder Add IBAction and Segue a UIBarButtonItem



有没有办法为一个UIBarButtonItem添加一个IBAction和一个segue?

我尝试在界面生成器中将 segue 和 IBAction 添加到 UINavigiationController 中的 UIBarButtonItem 中,但只有 segue 被触发。

你可以做的是创建一个从视图控制器到下一个视图控制器的 segue,并给它一个标识符。然后将目标/操作添加到 UIBarButtonItem,并在操作方法结束时调用 [self performSegueWithIdentifier:@"yourIdentifier" sender:self]

最新更新