I have a prepareForSegue
that passes an image like this to the next viewController
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
WizardPreview *controller = [segue destinationViewController];
controller.myPicture = myPicture;
}
On the viewWillAppear
of the viewController
being presented I have a like like this
CGImageRef imageRef = [self.myPicture CGImage];
the result is nil
The strange part is that self.myPicture
is not nil, but self.myPicture.CGImage
is.
Any reason for that?
NOTE: myPicture
is not nil when it is passed and even from viewWillAppear
, I test and I see that self.myPicture
is not nil.
NOTE 2: this is a code compiled for iOS 7 running on an iPhone with iOS 8.
You haven't posted enough code to say for sure. The three most likely options are:
myPicture
is nil
in the prepareForSegure:sender:
method WizardPreview
's myPicture
property is weak
UIImage
is not backed by a CGImage
(for example, if it's backed by a CIImage
) If #3 is true, you can create a CGImage
directly from a CIImage
( sample code here ).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.