Reputation: 2935
I know how to fetch image from photo library or camera in ios4.2.1
but in ios 5 there is new feature in photo app like if user wants to edit image or crop image then he is able to do such kind of things.
The same functionality I want to implement in my app when I grab image from camera or photo library.
the code by which I fetched image in ios 4.2.1 works also in ios 5 but by this code I am not able to edit or crop my image.
My code is as follows:
- (IBAction)btnCapturePressed:(id)sender {
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
ipc=[[UIImagePickerController alloc] init ];
ipc.delegate=self;
ipc.sourceType=UIImagePickerControllerSourceTypeCamera;
//btnUserImage.tag=-2;
[self presentModalViewController:ipc animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Nemo Rating" message:@"Camera capture is not supported in this device" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
-(void) imagePickerController:(UIImagePickerController *) picker didFinishPickingMediaWithInfo :(NSDictionary *)info
{
UIImage *imageToScale=[info objectForKey:UIImagePickerControllerOriginalImage];
// imageToScale=[imageToScale imageByScalingAndCroppingForSize:CGSizeMake(20,10)];
imageToScale=[imageToScale scaleToSize:CGSizeMake(95, 86)];
[btnUserImage setImage:imageToScale forState:UIControlStateNormal];
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if(version >= 5.0)
{
[[picker presentingViewController] dismissModalViewControllerAnimated:YES];
[picker release];
}
else
{
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
//[picker popViewControllerAnimated:YES];
[picker release];
}
}
This code simply give me the image but I am not able to edit it...
then is there any different code which make me able to edit or crop my image like photo app
for better understanding I upload followin screen shot. I take this screen shot from photo app.
thanks in advance.
Upvotes: 3
Views: 3592
Reputation: 19469
As Devang has suggested, I am afraid that there is NO way you can get the inbuilt Edit from the Photos app.
There is no way you can get access to Private API. "Photos" app is the Apple's application and hence it has some features which are not accessible by the developers in Public API.
Now the point is that you can only create and instance of photo library or camera and grab an image from there. But there is no way you can access the "Edit" function of the Photos application.
If at all you require to do it, then you need to find a way to code all the functionalities by yourself.
Hope this helps you.
Upvotes: 0