让iCarousel显示我拍的照片

时间:2013-07-16 02:19:21

标签: iphone ios icarousel

是否可以让iCarousel导入我在应用中拍摄的照片?我刚刚将iCarousel导入我的项目,我正在使用故事板,因为我将拥有多个视图控制器或屏幕。我添加了一个相机按钮,以便它可以在应用程序内拍照。这是我在视图控制器中编写的代码

-(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];
[self dismissViewControllerAnimated:YES completion:nil];

}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:NULL];

}

我希望拍摄的照片显示在另一个视图控制器上的Cover flow上。所以我可以轻扫图片。我怎么想做这个任务。我在互联网上搜索但我只找到了从支持文件中导入图片的方法。

这是我如何保存它...抱歉迟到

- (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];

0 个答案:

没有答案