0
我如何构建一个应用程序,首先在空白的UIView中,然后允许用户使用相机拍照,然后该图片将出现在UiView上,用户可以拖动和移动周围的图像。Iphone:出现并允许UIImage上的用户交互
这里是我的代码,我到目前为止,
-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if((UIButton *) sender == choosePhotoBtn) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
savebutton.hidden=NO;
}
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
-(void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {
NSString *message; NSString *title;
if (!error) {
title = NSLocalizedString(@"Image Saved Successfully!", @"");
message = NSLocalizedString(@"Tap Library and select this image.", @"");
}
else { title = NSLocalizedString(@"SaveFailedTitle", @""); message = [error description];
} UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:nil];
[alert show]; [alert release];
[message release]; [title release];}
-(IBAction) saveImage:(id)sender{
UIImage *img = imageView.image;
UIImageWriteToSavedPhotosAlbum(img, self, @selector(imageSavedToPhotosAlbum: didFinishSavingWithError: contextInfo:), nil);
}
也有在Xcode中的照片修改任何好的教程?
很多谢谢。
难道你不认为你是要求从同一个问题构建整个应用程序吗?试着先实现一些东西。 – Sarah 2011-12-19 09:25:04
我编辑了这些问题。我只知道如何启动相机并将其放置在UIImage上,但我不知道如何拖动这张照片。非常感谢 – Clarence 2011-12-19 09:33:41