I am trying to create a fun photo app. So far I have used UIPIckerViewController to pull up the camera/photo libarary and then load it to a UIImage View. I also have another UIImageView with a preloaded clipart (hat) that has UIGestures set. What I am trying to do now is load other customized clipart like hair, and sunglasses to the original picture and then save them to the camera roll. Am I headed in the right direction? and How should I go about doing this?
If it was me, I'd create a blank UIVIew called canvas and add the UIImageView and all my other clip art to that and then take a picture of it using canvas.layer renderInContext.
Here is the code to take a picture, just instead of self use canvas or whatever your view is named.
What I am trying to do now is load other customized clipart like hair, and sunglasses to the original picture and then save them to the camera roll. Am I headed in the right direction? and How should I go about doing this?
Domele gave you code that would let you flatten the contents of a "canvas" view into an image that contains all the different subviews combined.
in other words, he gave you a solution to what you are trying to do.
Set up a container view. Let's call it canvasView. In that view, add the image view the user picked as a subview. Also add views for hats, mustaches, hair, big ears, whatever. Let the user manipulate as desired.
Once you are ready to save, use the code Domele posted to flatten the canvas view and it's subviews into an image, and save that.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
If it was me, I'd create a blank UIVIew called canvas and add the UIImageView and all my other clip art to that and then take a picture of it using canvas.layer renderInContext.
Here is the code to take a picture, just instead of self use canvas or whatever your view is named.
If it was me, I'd create a blank UIVIew called canvas and add the UIImageView and all my other clip art to that and then take a picture of it using canvas.layer renderInContext.
Here is the code to take a picture, just instead of self use canvas or whatever your view is named.
I implemented your code and have successfully saved my images into my camera roll. The only thing now is I am getting my "Title Bars" in the image that is saved to the camera roll. Is there a way to customize the area of the initial picture?
Did you create a specific view for your image and all of its "accessories?" If so, you need to replace self.view with self.canvas or whatever your view is named.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.
Did you create a specific view for your image and all of it's "accesories?" If so, you need to replace self.view with self.canvas or whatever your view is named.
Question for screen captures that flatten... I'm using the following code which i have managed to get the size of the screen capture to work, however it starts from the top of the screen... how do i define where the screen capture starts from. i.e. if i have a toolbar at the top i want the screen capture at 60 pixels down + size i define?
THis is part of the code I'm using
background is the 'size' of the capture i want, but its cutting the wrong bit out of self!