[英]iOS: how to push ViewController over current context?
I have VC and I want to push it and to see the VC that under it. 我有VC,我想推动它并看到它下面的VC。
I can do it if I present if modally ( Display clearColor UIViewController over UIViewController ) 如果我以模态方式呈现( 在UIViewController上显示clearColor UIViewController ),我可以这样做
But is it possible to implement this feature via push VC? 但是可以通过推送VC实现这个功能吗? Or I need to create custom transition ? 或者我需要创建自定义过渡?
To expand on Wain's comment: 扩展Wain的评论:
UIImage
; 你可以在UIImage
渲染父视图; Here is a possible implementation in Swift: 这是Swift中可能的实现:
override func viewDidLoad() {
super.viewDidLoad()
// render parent view in a UIImage
UIGraphicsBeginImageContext(self.view.bounds.size);
self.parent?.view.layer.render(in: UIGraphicsGetCurrentContext()!)
let viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// add the image as background of the view
self.view.insertSubview(UIImageView(image: viewImage), at: 0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.