0
我有一個UIScrollView我在它以這種方式最好的初步實踐得出明確的圖像中的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];
顯示圖像,但圖像顯得有些模糊
雖然在其他視圖中以這種方式顯示相同的圖像(在側的UIImageView)
NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:[NSHomeDirectory() stringByAppendingFormat:@"/Documents/t%d.jpg",topicNum]];
[topicPicImageView setImage:[UIImage imageWithData:[fileHandle readDataToEndOfFile]]];
產生這種質量
我怎樣才能在UIScrollView中的圖像質量相同?
- 所述的圖像尺寸爲640×360
- 兩個圖像容器尺寸是320×164
AmAzing真的,非常感謝 – OXXY