1

I am writing a camera app (similar to the native camera app) so that when the snap button is touched, I want to quickly grab the picture (from the hidden imageView) before the view resets and is ready to take another picture. Below is a snippet of code and my problem is the line: CGImageRef img = (CGImageRef)[view imageRef]. It gives me an error:No visible @interface for "UIView" declares the selector 'imageRef'. How can I fix this error?

- (BOOL)TakePictureFromImageView:(UIView*)view {
    CGImageRef img = (CGImageRef)[view imageRef];
    if (img)
    {
        UIImage *photo = [self correctImageOrientation:img];
        UIImageWriteToSavedPhotosAlbum(thePhoto, nil, nil, nil);    
        return YES;
    }
    return NO;
}
Paul A.
  • 577
  • 2
  • 11
  • 24
  • There is no method `imageRef` in the `UIView` class. If you have a `UIImageView` object that has a `UIImage` object set in its `image` property, you can get a `CGImageRef` from the `CGImage` property of `UIImage`. However it's not clear from your code that that is what you're trying to do because you're trying to get an image from a `UIView`. You attempt to save something called `thePhoto` but we can't see where that is set either. – Andrew Tetlaw Jan 15 '13 at 10:15
  • @AndrewTetlaw, I have updated the code. Now, this is what I am trying to do: when the system camera app takes a picture, it automatically saves, it and refreshes the view to take another picture. I am trying to achieve something similar. I want to grab the picture taken from the imageview and save it before it refreshes. Thanks for your help and I will be looking out for your response and other contributions. – Paul A. Jan 15 '13 at 14:23

0 Answers0