在我的相机应用程序中,当我点击图像时,它会向用户询问标题和说明,然后保存它。现在保存图像但不要求标题和说明。我是iOS.so的新手,可能这是一个愚蠢的问题。请帮助我得到这个。对于相机点击我使用这种方法: -
- (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 :(得分:0)
您可以通过以下方式完成此操作:
使用以下代码行将图像保存到图片库:
UIImageWriteToSavedPhotosAlbum(UIImage * image,id completionTarget,SEL completionSelector,void contextInfo);
希望它对你有所帮助。
答案 1 :(得分:0)
对我来说,本教程指导我实现我想要的东西。所以,我想分享这个链接。可能会有人受益。
这段代码可以帮助我..
-(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;
}
}