2012-11-30 46 views
1

在我的相機應用程序中,我希望當我點擊圖像時,它會向用戶索要標題和描述,然後保存它。現在,它保存圖像,但不要求標題和描述。是新來的iOS.so,可能這是一個愚蠢question.please幫助我獲得我使用這種方法this.for相機點擊: -相機點擊圖像的標題和說明

- (void)viewWillAppear:(BOOL)animated 
{ 
    [super viewWillAppear:animated]; 

BOOL camera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]; 
if(camera) 
{ 
    UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
    [[picker navigationBar]setBarStyle:UIBarStyleDefault]; 
    picker.sourceType = UIImagePickerControllerSourceTypeCamera; 
    [picker setDelegate:self]; 
    [self presentViewController:picker animated:YES completion:NULL]; 

    [picker release]; 
} 
+0

請幫助我的人......我 – Shivaay

回答

0

對於我這個教程引導我去實現我want.So,我想分享link.May有人得到受益。

http://www.raywenderlich.com/13541/how-to-create-an-app-like-instagram-with-a-web-service-backend-part-22

這一段代碼可以幫助我..

-(void) takePhoto{ 
    BOOL camera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]; 
    if(camera) 
    { 
     UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
     [[picker navigationBar]setBarStyle:UIBarStyleDefault]; 
     picker.sourceType = UIImagePickerControllerSourceTypeCamera; 
     [picker setDelegate:self]; 
     [self presentViewController:picker animated:YES completion:NULL]; 
     [picker release]; 
     actionSheetbool = false; 
    } 

    else 
    { 
     UIAlertView* cameraAlert = [[UIAlertView alloc]initWithTitle:@"Sorry!!" message:@"Camera not found." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; 
     [cameraAlert show]; 
     [cameraAlert release]; 
    } 

} 
-(void)photoLibrary{ 
    if ([UIImagePickerController isSourceTypeAvailable: 
     UIImagePickerControllerSourceTypeSavedPhotosAlbum]) 
    { 
     UIImagePickerController *imagePicker = 
     [[UIImagePickerController alloc] init]; 
     imagePicker.delegate = self; 
     imagePicker.sourceType = 
     UIImagePickerControllerSourceTypePhotoLibrary; 
     imagePicker.allowsEditing = YES; 
     [self presentViewController:imagePicker animated:YES completion:nil]; 
     [imagePicker release]; 
     actionSheetbool = false; 
    } 
} 
0

你可以做到這一點通過以下方式:

  • 使用相機單擊圖像。
  • 回到你的應用程序而不保存圖像。直到現在,您的應用程序中都會有一個對應的圖像。
  • 請求用戶標題&說明。
  • 下次使用該行代碼圖片庫的圖像:

    UIImageWriteToSavedPhotosAlbum(的UIImage *圖像,ID completionTarget,SEL completionSelector,無效contextInfo);

希望它可以幫助你。

More Help Here....

+0

新來iOS.So,如果可能的話你能指導我如何寫這個問題的代碼?? – Shivaay