为 Web 视图添加 UI 栏按钮项,但应用崩溃
Adding UI Bar Button Items for WebView but app crashing
我已经在XCode中将以下代码添加到我的iOS项目中。它允许我向我的UINavigation控制器添加多个按钮 - 这些项目在应用程序中显示正常,但是当我按下"刷新"或"返回"按钮时,应用程序崩溃
我要做的是创建3个按钮 - 刷新,返回和前进。
我收到的错误说未声明的选择器"刷新"
// Create the refresh, fixed-space (optional), and profile buttons.
UIBarButtonItem *refreshBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)];
// // Optional: if you want to add space between the refresh & profile buttons
// UIBarButtonItem *fixedSpaceBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
// fixedSpaceBarButtonItem.width = 12;
UIBarButtonItem *profileBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(goToProfile)];
profileBarButtonItem.style = UIBarButtonItemStyleBordered;
self.navigationItem.rightBarButtonItems = @[profileBarButtonItem, /* fixedSpaceBarButtonItem, */ refreshBarButtonItem];
请点击链接
将在导航栏中添加更多按钮
检查refresh
方法的声明/定义。
根据您的代码action:@selector(refresh:);
refresh
方法应至少有一个参数。
如果你对refresh
方法的定义没有参数,那么它应该像action:@selector(refresh);
相关文章:
- 使用调试/崩溃报告将应用程序部署到客户端
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 如何找出应用程序崩溃的原因 - Win 10 LTSB
- 操纵安卓相机的深度图导致应用程序崩溃
- 为什么从文件获取图标时应用程序有时会崩溃?
- 在 Ubuntu 服务器上运行 QT 应用程序时崩溃
- 调用 java 的回调() 时应用程序崩溃.由于 detatchThread 而获得运行时错误
- Qt应用程序找不到第三方DLL并崩溃
- 由于____chkstk_darwin,在Catalina上使用部署10.10编译的MacOS应用程序在HighSierra版本<崩溃
- QCompleter set模型使应用程序崩溃
- x64 位的 C++/CLI DLL 和 Exe 的应用崩溃
- 为什么抓取窗口标题的代码会导致应用崩溃?
- 使用push_back方法获取智能指针矢量时应用崩溃
- 强制 c++ 应用崩溃
- 提升编程选项使我的应用崩溃
- 为 Web 视图添加 UI 栏按钮项,但应用崩溃
- 应用崩溃.模板
- 使用 C++/CLR dll 时 C# 应用崩溃
- "std::sin"呼叫上的应用崩溃
- 使用特征库运行 UmfPackLU<> 上的应用崩溃