How to display .tiff images in iphone?

自闭症网瘾萝莉.ら 提交于 2019-12-02 22:50:39

问题


I want to display .tiff images coming from server in my native iphone application. Is it possible to display .tiff images in native iphone application? I am trying to solve this problem since 2 hrs with no success. I searched the net for nearly 2 hrs with no solution to this problem.

Can anyone help me to solve this problem...

Any sample code will be very helpful...

Thanx in advance...


回答1:


Here it says that the tiff format is supported by the UIImage class so you can load it in one of those and put it into an UIImageView. Have you already tried this? If the answer is yes, post some code




回答2:


Yes. You can display tiff images coming from the server. You can load these images into WebView or UIImageView. What you need to do is :

You need to encode the data which comes from the server.After encoding the data, you need to add it inside the WebView. Example :

NSMutableData *recievedData; // the data coming from the server

......

NSString *str = [receivedData base64Encoding]; //my base64Encoding function

NSData *new_data = [NSData dataWithBase64EncodedString:str]; my function

UIImage *image2 = [UIImage imageWithData:new_data];

[image_view setImage:image2];

[web_view loadData:new_data MIMEType:@"image.tiff" textEncodingName:nil baseURL:nil];


来源:https://stackoverflow.com/questions/3651237/how-to-display-tiff-images-in-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!