【发布时间】:2013-07-17 06:37:42
【问题描述】:
我有一个 UIscrollView 我正在以这种方式在其中显示图像
- (UIImage *)pageControlImageWithIndex:(NSInteger)index{
NSString *imagePath = [NSHomeDirectory() stringByAppendingFormat:@"/Documents/t%d.jpg",index];
NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:imagePath];
return [UIImage imageWithData:[fileHandle readDataToEndOfFile]];
}
UIImage *image = [self pageControlImageWithIndex:pageNumber];
UIGraphicsBeginImageContext(CGSizeMake(320.0, 164));
[image drawInRect:CGRectMake(0, 0, 320.0, 164.0)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.view.backgroundColor = [UIColor colorWithPatternImage:newImage];
但图像看起来有些模糊
同时在其他View(UIImageView内部)以这种方式显示相同的图像
NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:[NSHomeDirectory() stringByAppendingFormat:@"/Documents/t%d.jpg",topicNum]];
[topicPicImageView setImage:[UIImage imageWithData:[fileHandle readDataToEndOfFile]]];
生产这种品质
如何在 UIScrollView 中获得相同质量的图像?
- 图片尺寸为640 * 360
- 两个图像容器尺寸为 320 * 164
【问题讨论】:
标签: objective-c uiimageview uiimage uigraphicscontext