gpt4 book ai didi

ios - 使用一个 BarButton 推送到不同的 View

转载 作者:行者123 更新时间:2023-11-29 03:33:22 25 4
gpt4 key购买 nike

我的主窗口在右上角有一个导航栏和一个 BarButton。我有一个保存的值,根据它是真还是假,我想推送到不同的 Controller 。现在推送到一个只是 IB 中的 Ctrl+Drag,但是如果我想在要推送的 View 之间选择怎么办?有什么建议吗?

最佳答案

只需实现一个与 ~UIBarButton 连接的简单 IBAction

-(IBAction)barButtonPressed {
if (yourBoolean) {
TrueViewController *trueViewController = [[TrueViewController alloc] init];
[self.navigationController pushViewController:trueViewController animated:YES];
} else {
FalseViewController *falseViewController = [[FalseViewController alloc] init];
[self.navigationController pushViewController:falseViewController animated:YES];
}

关于ios - 使用一个 BarButton 推送到不同的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19495787/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com