将图像从 Objective VC 发送到 Swift 配置 VC
Send image from Objective VC to Swift configured VC
我正在做一个项目,需要使用 segue 或故事板将编辑后的图像发送到另一个 ViewControler
。
先了解几点。
- 我正在发送使用
Objective C
配置的图像 ViewController
。
- 并且图像将通过
ViewController
使用 Swift
Lang 配置。
问题:
The Swift Class which is imported in Objective .m file is not visible so it lets me to create its object to make reference of its members.
我试过了:
// here i am not able to create SwiftVC class object so i can pass image further
SwfitVC *object = [self.storyboard instantiateViewControllerWithIdentifier:@"VC_Identifire"];
object.image = image;
[self.navigationController pushViewController:object animated:YES];
SwftVC Class is not visible after importing to .m file.
请看。谢谢。
替代方式:
您可以将图像保存到 Objective-c class 中的文档目录并将其提取到 Swift Class.
可能对这个逻辑有帮助。
为了使您的 Swift 文件可见;在您的 .m 文件中,您必须编写此导入语句。
#import "YourProjectName-Swift.h"
清理并构建然后您将能够使用您的 Swift class。
我正在做一个项目,需要使用 segue 或故事板将编辑后的图像发送到另一个 ViewControler
。
先了解几点。
- 我正在发送使用
Objective C
配置的图像ViewController
。 - 并且图像将通过
ViewController
使用Swift
Lang 配置。
问题:
The Swift Class which is imported in Objective .m file is not visible so it lets me to create its object to make reference of its members.
我试过了:
// here i am not able to create SwiftVC class object so i can pass image further
SwfitVC *object = [self.storyboard instantiateViewControllerWithIdentifier:@"VC_Identifire"];
object.image = image;
[self.navigationController pushViewController:object animated:YES];
SwftVC Class is not visible after importing to .m file.
请看。谢谢。
替代方式:
您可以将图像保存到 Objective-c class 中的文档目录并将其提取到 Swift Class.
可能对这个逻辑有帮助。
为了使您的 Swift 文件可见;在您的 .m 文件中,您必须编写此导入语句。
#import "YourProjectName-Swift.h"
清理并构建然后您将能够使用您的 Swift class。