私は画像を保存する方法を知っており、これが今までのコードです。このコードは、ユーザーがボタンをタップして写真を撮ることができることを示しています。
-(IBAction)TakePhoto {
picker = [[UIImagePickerController alloc]init];
picker.delegate = self;
[picker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentViewController:picker animated:YES completion:nil];
}
- (IBAction)ChooseExisting {
picker2 = [[UIImagePickerController alloc]init];
picker2.delegate = self;
[picker2 setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self presentViewController:picker2 animated:YES completion:nil];
}
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
image = [info objectForKey:UIImagePickerControllerOriginalImage];
[imageview setImage:image];
//Save Your Image ======
UIImage *yourImage = imageview.image;//imageView.image;
NSString *docDirPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *filePath = [docDirPath stringByAppendingPathComponent:@"myImageFile.png"];
[UIImagePNGRepresentation(yourImage) writeToFile:filePath atomically:YES];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:NULL];
}
ただし、保存した写真を、ユーザーがセグメント ビュー コントロールを使用してタップする必要がある 6 つのカテゴリまたはジャンルに分類したいと考えています。これは可能ですか?私はiosプログラミングとxcodeのobjective-cが非常に新しく、多くのビューコントローラーと混同していますが、これが機能するのが本当に好きで、このトピックに関するリソースが見つかりません. ありがとう。