sen*_*thu 14 iphone uiviewcontroller uiview ipad uigesturerecognizer
嗨,我有Parentview - >多个子视图.当我在父视图中使用[self bringSubviewToFront:childview]时,它工作正常.但是在将childchildview添加到childview后,当我在parentview中使用[self bringSubviewToFront:grandchildview]时,它不起作用吗?有什么帮助吗?
Dar*_*ust 61
该-[UIView bringSubviewToFront:]方法仅适用于直接儿童,而不适用于孙子女.请记住,视图层次结构是一棵树,通常视图只知道其"父"(或超级视图)及其直接"子"(或子视图).你需要做这样的事情:
// First, get the view embedding the grandchildview to front.
[self bringSubviewToFront:[grandchildview superview]];
// Now, inside that container view, get the "grandchildview" to front.
[[grandchildview superview] bringSubviewToFront:grandchildview];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27934 次 |
| 最近记录: |