ios - 如何将 UIButton 设置为转到上一个屏幕?

标签 ios xcode uibutton

我有一个可以从任何其他屏幕访问的帮助屏幕。唯一的按钮有一个“后退”箭头。现在它总是回到主屏幕。但是,我需要它返回到它之前的屏幕。我已经通过 stackoverflow 和谷歌搜索,但没有运气。

编辑 我现在使用的代码片段:

appViewController *homeView = [[appViewController alloc] initWithNibName:nil bundle:nil];
homeView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:homeView animated:YES];

最佳答案

在当前显示的模态视图 Controller 中,使其在单击主页按钮时自动消失:

- (void)buttonClicked
{
    [self dismissModalViewControllerAnimated:YES];
}

关于ios - 如何将 UIButton 设置为转到上一个屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10594101/

相关文章:

ios - 在不更改父 View / super View 的情况下,在界面生成器中拖动和移动某些内容

ios - 为什么我的 UIButton 的选中状态在我松开手指之前没有触发?

ios - 如何在 Swift 编程中获得基于导航的模板功能

ios - 从 iOS 11 中的本地通知打开 View Controller

ios - Xcode 崩溃错误

iphone - UIButton 渐变不起作用

swift - 通过点击更改 UIButton 的图像 - Swift

ios - 将行添加到不带动画的表格 View 的开头

ios - Swift-更改具有自己样式的 HTML 字符串上的字体

ios - 替换已弃用的 .WeekdayCalendarUnit