隐藏parentView和子视图,而不是最后添加的子视图

时间:2021-06-27 11:27:49

I have custom parent view, which is a sub class UIView with some UIImageView's, UILabel's etc..

我有自定义父视图,这是一个子类UIView与一些UIImageView,UILabel等。

I add as a subview screenshot of it.I would like to hide all the subviews and the parent view rather then that screenshot.

我添加了它作为子视图的截图。我想隐藏所有子视图和父视图而不是那个截图。

Any help on this is appreciated.

对此有任何帮助表示赞赏。

Code:

码:

self.temp = [self snapshotViewAfterScreenUpdates:NO];
self.temp.frame = self.bounds;
[self addSubview:self.temp];

1 个解决方案

#1


0  

I hope the screenshot is one of the subview of your parent view. So hiding the parent view will hide all the subviews including the screenshot.

我希望屏幕截图是您父视图的子视图之一。因此,隐藏父视图将隐藏所有子视图,包括屏幕截图。

You can do the following

您可以执行以下操作

  • Make the screenshot size, bound to the parent and add to top
  • 制作屏幕截图大小,绑定到父级并添加到顶部
  • Present the screenshot as a popover/modal-view and blur the parent view
  • 将屏幕截图显示为popover / modal-view并模糊父视图
  • Remove/hide all the subviews from the parent except the screenshot
  • 删除/隐藏除截图之外的所有子视图

#1


0  

I hope the screenshot is one of the subview of your parent view. So hiding the parent view will hide all the subviews including the screenshot.

我希望屏幕截图是您父视图的子视图之一。因此,隐藏父视图将隐藏所有子视图,包括屏幕截图。

You can do the following

您可以执行以下操作

  • Make the screenshot size, bound to the parent and add to top
  • 制作屏幕截图大小,绑定到父级并添加到顶部
  • Present the screenshot as a popover/modal-view and blur the parent view
  • 将屏幕截图显示为popover / modal-view并模糊父视图
  • Remove/hide all the subviews from the parent except the screenshot
  • 删除/隐藏除截图之外的所有子视图