IOS: 如何前后发送图像视图
IOS: How to send an Image View back and front
在我的故事板中,我有一个视图,其中有一个 ImageView
和一个 Button
。 ImageView
当前覆盖了我的按钮,我想将按钮放在 ImageView 上。我找到了类似的主题,这些主题通过 "Editor" -> "Arrange" -> "Send to Front" 解决了,但是这是针对 UIViews
完成的,并且此选项对于 [=11= 是被动的] 和 Buttons
.
那么如何将我的 ImageView
发送到后台呢?最好的解决方案是只为 Button
添加一个额外的视图,然后将它放在前面吗?
解决方案是在 "Document Outline" 部分上下移动视图组件。
或者,您可以使用 bringSubviewToFront
函数解决问题:
[self.view bringSubviewToFront:self.yourButtonControl];
您可以在故事板上重新排列您的观点:
第一个视图将被下一个视图隐藏。
也许这个选项对您的 运行 申请也有用:
myImageView.layer.zPosition = -5;
myImageView.layer.zPosition = 5;
喜欢HTML/CSS。
在我的故事板中,我有一个视图,其中有一个 ImageView
和一个 Button
。 ImageView
当前覆盖了我的按钮,我想将按钮放在 ImageView 上。我找到了类似的主题,这些主题通过 "Editor" -> "Arrange" -> "Send to Front" 解决了,但是这是针对 UIViews
完成的,并且此选项对于 [=11= 是被动的] 和 Buttons
.
那么如何将我的 ImageView
发送到后台呢?最好的解决方案是只为 Button
添加一个额外的视图,然后将它放在前面吗?
解决方案是在 "Document Outline" 部分上下移动视图组件。
或者,您可以使用 bringSubviewToFront
函数解决问题:
[self.view bringSubviewToFront:self.yourButtonControl];
您可以在故事板上重新排列您的观点:
第一个视图将被下一个视图隐藏。
也许这个选项对您的 运行 申请也有用:
myImageView.layer.zPosition = -5;
myImageView.layer.zPosition = 5;
喜欢HTML/CSS。