我的iPad应用程序有一个导航,我显示不同页面的屏幕截图,因为我想一次显示多个屏幕截图,我将容器缩放到原始屏幕截图的24%左右(1024×768)。当包含UIView时UIImage/UIImageView重绘缩放
- (void) loadView
{
// get landscape screen frame
CGRect screenFrame = [UIScreen mainScreen].bounds;
CGRect landscapeFrame = CGRectMake(0, 0, screenFrame.size.height, screenFrame.size.width);
UIView *view = [[UIView alloc] initWithFrame:landscapeFrame];
view.backgroundColor = [UIColor grayColor];
self.view = view;
// add container view for 2 images
CGRect startFrame = CGRectMake(-landscapeFrame.size.width/2, 0, landscapeFrame.size.width*2, landscapeFrame.size.height);
container = [[UIView alloc] initWithFrame:startFrame];
container.backgroundColor = [UIColor whiteColor];
// add image 1 (1024x768)
UIImage *img1 = [UIImage imageNamed:@"01.jpeg"];
UIImageView *img1View = [[UIImageView alloc] initWithImage:img1];
[container addSubview:img1View];
// add image 2 (1024x768)
UIImage *img2 = [UIImage imageNamed:@"02.jpeg"];
UIImageView *img2View = [[UIImageView alloc] initWithImage:img2];
// move img2 to the right of img1
CGRect newFrame = img2View.frame;
newFrame.origin.x = 1024.0;
img2View.frame = newFrame;
[container addSubview:img2View];
// scale to 24%
container.transform = CGAffineTransformMakeScale(0.24, 0.24);
[self.view addSubview:container];
}
但是当我缩放图像与“小”的文字看上去某事像这样:
我必须使用大屏幕截图,因为如果用户点击图片,应该扩展到100%,清脆。
有没有一种方法可以在不损坏性能的情况下“顺利”(即时)调整图像? 它有足够的两个版本:完整的一个和另一个为24%的版本。
我简化了代码位。但因为截图应该是(种)互动,我不能只是从所有的截图创建一个大的图像:( – pkyeck 2012-01-12 15:49:36