我有以下问题: 我创建一个 View Controller ,并在其中添加一个 subview Controller 。 subview Controller View 插入到父 View Controller 的现有 subview (按钮 A)下方。 当我尝试转换到新的 subview Controller 时,其 View 不再添加到按钮 A 下方,而是添加到其上方。
有没有办法保持 subview 的Z位置?
最佳答案
添加新的 View Controller 后,调用:
[parentView bringSubviewToFront:theButton];
或者,使用 insertSubview:belowSubview:
插入新的 View Controller ,并为 belowSubview:
参数指定按钮。
关于ios - 查看 Controller 遏制 Z 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18383895/