简体   繁体   English

iOS持久视图图层值?

[英]iOS Persist view layer value?

I have an application where a user can drag many images onto a canvas. 我有一个应用程序,用户可以将许多图像拖到画布上。 Some views are above other views. 有些观点高于其他观点。 I want to save the images transforms, frames, and z-index. 我想保存图像变换,帧和z-index。 Where do I find the z-index of a view (in comparison with other views on the superview) so I can persist it. 我在哪里可以找到视图的z-index(与superview上的其他视图相比),所以我可以坚持下去。 And then how to I restore all subviews to their proper z-index? 然后如何将所有子视图恢复到正确的z-index?

The superview have an array of child, into which the child are in order from back 0 to top (number of child) and there is method to insert child at a certain index. superview有一个子数组,子项从0后到上(子数),并且有一个方法可以在某个索引处插入子项。

There is a section of method in the UIView documentation with method that look like this one: UIView文档中有一段方法,其方法如下所示:

- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index

看起来你正在寻找视图层的(set / get) zPosition

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM