我想要缩小"预览"另一个ViewController
中的另一个ViewController
。这可能吗?不需要任何交互,因此它基本上可以是截图,但缩小。我可以通过手动截取屏幕并将其保存为图像来解决,但ViewController
包含大量本地化并且不断更新,因此如果可以以编程方式完成此操作。
https://www.dropbox.com/s/kd5vinrym1k7afk/Screenshot%202014-05-13%2015.20.17.png
这可能吗?
编辑:子视图存储在故事板中
编辑:这就是我解决它的方式:
//Load the viewcontroller and view
previewViewController = [self.storyboard instantiateViewControllerWithIdentifier:[PLACEHOLDER_VIEWCONTROLLER_NAMES objectAtIndex:self.identifier]];
[self addChildViewController:previewViewController];
[self.placeholderView.superview addSubview:previewViewController.view];
previewViewController.view.transform = CGAffineTransformMakeScale(scale*2, scale*2);
CGPoint center = self.placeholderView.center;
center.y += 25;
previewViewController.view.center = center;
答案 0 :(得分:5)
使用viewController.view
,然后将其缩小为:
viewController.view.transform = CGAffineTransformMakeScale(0.5, 0.5);
答案 1 :(得分:0)
Add your another view controller view as subview to first viewcontroller
[UIView animateWithDuration:2.0f animations:^{
InnerView.userInteractionEnabled = NO;
//Always starts from original scale
InnerView.transform = CGAffineTransformMakeScale(0.5, 0.5);
//Incremental scale
//InnerView.transform = CGAffineTransformScale(InnerView.transform, 0.5, 0.5);
} completion:^(BOOL finished) {
NSLog(@"in Half size");
}];
[UIView animateWithDuration:2.0f animations:^{
InnerView.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished) {
InnerView.userInteractionEnabled = YES;
NSLog(@"Normal size");
}];