[英]How to display or pass camera capture image into other views in iphone
I am new to i phone programming.Once i capture picture that picture iam displaying in same view,after applying image filter effect i have taken preview button if i click on preview button means same image i want to display in another view but image is not going to next view.how can i do this can any body help me.Inside preview button i have given this below code Thanks 我是电话编程的新手。一旦我捕获了在同一视图中显示的图像,则在应用图像滤镜效果之后,如果单击预览按钮,则我已经单击了预览按钮,这意味着我想在另一视图中显示同一图像,但是图像却没有转到下一个view。我该怎么做,任何机构都可以帮助我。在预览按钮内部,我给出了以下代码,谢谢
preview *p=[[preview alloc]init];
p.secondimageviewobject= firstimageviewobject.image;
[self presentModalViewController:p animated:YES];
Well for this kind of method, you would have to create a singleton class like ShareClass.h
or if you are really new (and dont know about this) , in the AppDelegate.h
wherein you would have to declare a UIImage
say UIImage *SavedImage
. 对于这种方法,您必须在AppDelegate.h
创建一个像ShareClass.h
这样的单例类,或者如果您真的很新(并且对此一无所知),则必须声明一个UIImage
例如UIImage *SavedImage
。
Now call this class in the view where you are capturing the image . 现在,在要捕获图像的视图中调用此类。 Then save this captured image in the SavedImage
. 然后将此捕获的图像保存在SavedImage
。 To share this image you would then call the ShareClass.h
class or the AppDelegate.h
in the view in which you want to share the image and display it in the UIImageView
. 要共享此图像,您可以在要共享图像的视图中调用ShareClass.h
类或AppDelegate.h
并将其显示在UIImageView
。
Any clarifications please ask. 任何澄清请询问。 :) :)
In the ShareClass.h
在ShareClass.h
UIImage *SavedImage;
@interface ShareClass : NSObject
{
}
In the Class where the image was captured, First import the ShareClass.h
, then 在捕获图像的类中,首先导入ShareClass.h
,然后导入
imagepicker.sourceType = UIImagePickerControllerSourceTypeCamera;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
imagepicker.sourceType = UIImagePickerControllerSourceTypeCamera;
SavedImage = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:imagepicker animated:YES completion:NULL];
}
In the Class where the image should be displayed again import the ShareClass.h
在应该再次显示图像的类中,导入ShareClass.h
UIImageView *DisplayImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:SavedImage]];
DisplayImage.frame=CGRectMake(0, 0, 20, 20);
[self.view addSubView:DisplayImage];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.