0

我希望它像这样流动,我做了很多次和剂量工作。

  • 用户按下应用程序中的照片按钮并拍照。

  • 拍照后用户必须输入细节。排序选项出现,用户可以选择 8 种不同的默认类型,然后用户按下保存。

  • 它返回主屏幕,用户可以在按钮中看到 8 种不同的流派,当推送的图片作为保存在应用程序中的封面流(流封面)出现时。
    我想让它像上面那样工作,但工作量不大。

到目前为止,我的代码是:

@implementation ViewController

-(IBAction)TakePhoto {
picker = [[UIImagePickerController alloc]init];
picker.delegate = self;
[picker setSourceType: UIImagePickerControllerSourceTypeCamera ];
[self presentViewController:picker animated:YES completion:NULL];
}

-(IBAction)ChooseExisting{
picker2 = [[UIImagePickerController alloc]init];
picker2.delegate = self;
[picker2 setSourceType: UIImagePickerControllerSourceTypePhotoLibrary];
[self presentViewController:picker2 animated:YES completion:NULL];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:
(NSDictionary *) info {
image = [info objectForKey:UIImagePickerControllerOriginalImage] ;
[imageview setImage:image];
[self dismissViewControllerAnimated:YES completion:NO];
}
- (void) imagePickerControllerDidCancel:(UIImagePickerController *)picker{
[self dismissViewControllerAnimated:YES completion:NULL];
}


@end

@implementation CVCLCoverFlowLayout
-(NSInteger)count {
return [self.collectionView numberOfItemsInSection:0 ];
}
-(CGSize)collectionViewContentSize{
CGSize size = self.collectionView.bounds.size;
size.width  = self.count * self.cellInterval;
return size;
}
4

1 回答 1

0

您没有保存在委托功能中单击的图像。当您想使用保存的图像时,您需要写下相同的代码。:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *) info {

image = [info objectForKey:UIImagePickerControllerOriginalImage] ;

[图像视图集图像:图像];

/将图像保存到应用程序的本地存储/

[自我dismissViewControllerAnimated:是完成:否];

您可以检查相同的代码:http: //dcraziee.wordpress.com/2013/05/20/how-to-save-and-get-image-from-cache-directory/

如果您喜欢,请分享该博客。

于 2013-05-20T10:31:08.417 回答