2011-12-19 9 views
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での写真の修正上の任意の良いチュートリアルがあるのでしょうか?

多くのありがとうございます。

+2

あなたは同じ質問からアプリ全体を構築するよう求めているとは思わないのですか?最初に何かを実装してみてください。 – Sarah

+0

質問を編集しました。私はちょうどカメラを起動し、UIImage上に配置する方法を知っているが、私はこの絵をどのように周りにドラッグするか分からない。どうもありがとう – Clarence

答えて

0

uitouchmovedクラスの助けを借りて、あなたは簡単にuiviewの画像の周りを動かすことができます。thisを参照してください。

関連する問題