我知道如何在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