iphone - 通过 UINavigationController 传递图像

标签 iphone objective-c ios uinavigationcontroller uiimage

我的 RootViewController 中有一个图像(从 UIImagePickerController 中选择),我需要通过导航 Controller 将其传递到新 View 。我有以下代码用于将字符串传递到下一个 View :

//Get strings
NSString *text1 = line1.text;
NSString *text2 = line2.text;
NSString *text3 = line3.text;
NSString *text4 = line4.text;

//Create an GeneratedViewController and initialise it with given data
GeneratedViewController *gController = [[GeneratedViewController alloc] initWithNibName:@"GeneratedViewController" bundle:[NSBundle mainBundle]];
gController.text1 = text1;
gController.text2 = text2;
gController.text3 = text3;
gController.text4 = text4;
[self.navigationController pushViewController:gController animated:YES];
[gController release];
gController = nil;

我如何将图像传递给 GeneratedViewController?

谢谢,

jack

最佳答案

最简单的解决方案是在 GeneratedViewController 上创建一个 UIImage 类型的属性。 然后在创建和初始化 GeneratedViewController 之后但在将其推送到 navigationController 之前,您需要将 gController 上的图像属性设置为所选图像。

关于iphone - 通过 UINavigationController 传递图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6486442/

相关文章:

iphone - ios5 模拟器中的 storekit 支持 - 键盘不起作用?

iphone - iOS 中的 LocationManager 在调用委托(delegate)之前重新分配

iphone - 为什么我们在 objective-c 中使用 int sqlite3_bind_int(sqlite3_stmt*, int, int) ?

ios - 可以在 Xamarin Test Cloud 中启用 iPhone 设备密码吗?

ios - 如何在 UIWebView 中获取检测到的数字

iphone - 识别 C 变量

objective-c - 使用 XCTestCase objective-C 的多重测试性能

ios - 无法在 Xcode 中编译 Storyboard并开始分配所有 RAM

android - 处理与 Android/IOS/移动云应用程序的 PHP session

iphone - 为什么 UITableView 的滑动删除有时工作正常有时不工作?