objective-c - 如何将 Objective C View Controller 推送到 Swift View Controller

标签 objective-c xcode uiviewcontroller swift

在我的 Objective-C View Controller 中,我需要推送到下一个 Swift View Controller ,我的基本项目 - obj c,添加 swift 文件后,Xcode 生成 Bridging-Header.h,但我没有看到 -swift.h 文件

热衷于从 obj-c View 插入 swift View 吗?

-(void)longTapInDaClub:(UILongPressGestureRecognizer *)longTap {

  UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"mail" bundle:nil];
nextView *view = (nextView *) [stb instantiateViewControllerWithIdentifier:"next"];
[nextView getIdSample: _idSample];
[self.navigationController pushViewController:view animated:YES];
} 

nextView - 是 Swift View Controller

最佳答案

我解决了问题 - 在项目设置 -> build设置 -> 产品模块名称 -> 并输入没有特殊字符和数字字符的有效名称 - 重建项目并#import“moduleName-swift.h”

关于objective-c - 如何将 Objective C View Controller 推送到 Swift View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26211475/

相关文章:

ios - 如何使用 Objective-C 集成 SiriKit?

ios - 仅适用于 iPhone 而非 iPod 的应用程序。 (例如 Whatsapp)

objective-c - ATOI() 结果为 "Exited Unexpectedly/Lost Connection"

ios - 发送到不可变对象(immutable对象)的变异方法 - [__NSCFDictionary setObject :forKey:]

xcode - 在工作站上浏览由我正在开发的 iOS 应用程序在设备上创建的文件?

ios - 为什么我在检查发件人的类别时收到错误 "Cannot assign to the result of this expression"?

ios - (iOS) 我如何对 UI 元素的翻译进行动画处理,例如两个 View Controller 之间转换中的标签和图像?

ios - 从另一个 UIViewController Swift iOS 中删除一个 View Controller

ios - 当您离开然后返回时,TableView 会重新加载

ios - UI 开关保存位置 NSSUser defaults 仅在手动切换时有效