我知道如何在ios4.2.1iPhone:如何从照片库或相机将像iPhone照片应用程序的“编辑”功能也有所
但在iOS 5中取从照片库或照相机获取图像的图像有新功能在照片应用中,如果用户想要编辑图像或裁剪图像,那么他可以做这样的事情。
当我从相机或照片库抓取图像时,我想在我的应用程序中实现相同的功能。
我在ios 4.2.1中获取图像的代码也适用于ios 5,但通过此代码我无法编辑或裁剪我的图像。
我的代码如下:
- (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];
}
}
这个代码只是给我的形象,但我不能编辑它...
那么有没有什么不同的代码,这使得我能够编辑或裁剪我的图片像照片的应用程序
为更好地理解我上传followin屏幕截图。我从照片应用程序采取此屏幕截图。
在此先感谢。
Edit是苹果在“照片”应用程序提供的功能。你必须自己编写代码 – Devang 2012-03-06 08:17:39