Reputation: 1647
I have an UIImageView with an UIButton that that I want to be able to send as an image with email, but the UIButton in the UIImageView wont be "stickied" with the UIImageView's image when I take the image out from the UIImageView.
Any suggestions?
Thanks in advance.
Upvotes: 0
Views: 99
Reputation: 1010
You can add UIButton and UIImageView and get the required screenshot image using the following code. You might need to add the QuartzCore.framework to your project and #import
To get the image with other UI elements.
UIGraphicsBeginImageContext(CGSizeMake(320, 480)); // Here provide width and height of UIImageView
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];//Here use required view
UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();//outputImage is your required image
UIGraphicsEndImageContext();
To display the image
UIImageView * screenShotView = [[UIImageView alloc] initWithImage:outputImage];
[screenShotView setFrame:CGRectMake(0, 0, 320, 480)];
[self.view addSubview:screenShotView];
Upvotes: 1