試試這個:
UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
imgPicker.delegate = self;
imgPicker.allowsImageEditing = YES;
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imgPicker animated:YES];
[imgPicker release];
下面是委託方法:
#pragma mark UIImagePickerController delegate
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *imgCapturePhoto = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[self dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker
{
[picker dismissModalViewControllerAnimated:YES];
}
編碼快樂......
從HTML頁面我按下它附帶的按鈕到.m文件,所以我們使用uiwebview所以上面的編碼是有用的,只有我們使用uiview .. –
看到這篇文章我問這樣http://stackoverflow.com/questions/2915881/access-camera-from-uiwebview但我試過,我有空頁面相機的樣本沒有打開..任何想法? –