I want to get the UIImage out of CGContextRef, and show it on UIImageView in a different UIViewController
So for this, I have written this code, I m writing this code, when I close my drawingview, because I have made my drawing view as a subview of UIViewController
//mydrawingView.m
- (void)closeButtonClicked
{
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO,0.0);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
m_curImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
ViewController *table = [[ViewController alloc] init];
[table setImage:m_curImage];
[table viewDidLoad];
}
///myViewController.h
@interface ViewController : UIViewController
{
IBOutlet UIImageView *m_imageView;
UIImage *image;
}
@property(nonatomic, strong) UIImage *image;
///myViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
m_imageView.image = image;
NSLog(@"%@", m_imageView.image);
}
But I am not able to show this image on UIImageview,
Regards Ranjit
I have sorted out the answer for this question, to get the image out of the canvas , the above code applies and to show it on a imageView of anotherViewController, we have to implement delegate protocol method.
Regards Ranjit