【发布时间】:2018-02-11 16:05:58
【问题描述】:
所以我正在构建一个 IOS 应用程序,并且我有一个显示的照片库,当你按下一张照片时,它会注册,你可以用那张照片做一些事情。基本上我需要的是当用户按下那张照片时,我需要它来打开另一个屏幕(segue),我需要知道在那个新屏幕上按下的特定照片是什么,并将屏幕大小的 UIViewController 设置为该照片。我目前拥有的代码是
PhotoEditorViewController *editor = [[PhotoEditorViewController alloc] init];
ALAsset *asset = self.assets[indexPath.row];
ALAssetRepresentation *defaultRep = [asset defaultRepresentation];
editor.img = [UIImage imageWithCGImage:[defaultRep fullScreenImage] scale:[defaultRep scale] orientation:UIImageOrientationRight];
NSLog(@"Photo Pressed");
NSLog(@"%@", editor.img);
[self presentModalViewController:editor animated:YES];
所以目前正在做的是获取按下的照片并设置我的 UIImage var。 “img”作为该图像,然后当调用 segue 时,我可以在其他屏幕上看到图像传输过来的 viewDidLoad 方法,但由于某种原因,我无法将该图像设置为 UIImageViwer。
NSLog 输出:
在屏幕一和屏幕二上都显示 UIImage 0x#######
这让我相信照片 ID 信息正在传输但它没有更新 uiimageview
ViewDidLoad
{
NSLog(@“%hhu%”, editorPhoto);
[image setImage:editorPhoto];
}
【问题讨论】:
-
请在“第二个屏幕”上显示应该是“更新 UIImageView”的 PhotoEditorViewController 代码。
-
@matt 我添加的代码不在家,所以我只添加了重要的代码。因此,当代码运行时,它会打印正确的内容,但如果您将断点设置为 setImage,则会显示图像为空
标签: ios objective-c iphone uiimageview uiimage