简体   繁体   English

如何将一个大的tif文件分解为多个UIImage,以显示在UIImageView中?

[英]How can I break up a large tif file into multiple UIImage's for display in a UIImageView?

I am consuming a web service that is returning electronic faxes in the form of tif (base 64 encoded text). 我正在使用一种Web服务,该服务以tif(基于64位编码的文本)的形式返回电子传真。 The thing is it is returning multi-page faxes as one large tiff file and ideally I want the user to be able to click through the various pages. 事实是,它将多页传真作为一个大的tiff文件返回,理想情况下,我希望用户能够单击各个页面。 When I decode the text and display, it only shows the first page in the UIImageView. 当我解码文本并显示时,它仅显示UIImageView中的第一页。

Can someone point me in the right direction? 有人能指出我正确的方向吗?

I've create my own solution for this: NSTiffSplitter . 我为此创建了自己的解决方案: NSTiffSplitter You can find it on github . 您可以在github上找到它。

NSString *pathToImage = [[NSBundle mainBundle] pathForResource:@"Example" ofType:@"tiff"];
NSTiffSplitter* splitter = [[NSTiffSplitter alloc] initWithPathToImage:pathToImage];
UIImage *page = [[UIImage alloc] initWithData:[splitter dataForImage:page]];
yourImageView.image = page;
[page release];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM