HI, tengo Parentview -> childviews múltiples. cuando se utiliza [bringSubviewToFront auto: childview] en parentview, funciona fine.but después de añadir grandchildview a childview, cuando uso [auto bringSubviewToFront: grandchildview]? En parentview, no funcionó ninguna ayuda por favor?bringSubviewToFront problema?
11
A
Respuesta
52
-[UIView bringSubviewToFront:]
El método sólo funciona para dirigir a los niños, no nietos. Recuerde que la jerarquía de la vista es un árbol, y, normalmente, una vista de sólo conoce su "padre" (o supervista) y sus directos "niños" (o subvistas). Usted tendría que hacer algo como esto:
// 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];
0
mi contribución con la versión rápida de la solución comprobada
self.bringSubviewToFront(self.grandchildview.superview!)
self.grandchildview.superview!.bringSubviewToFront(self.grandchildview)
Cuestiones relacionadas
- 1. bringSubviewToFront para CALayer
- 2. Versión OS X de bringSubviewToFront :?
- 3. UIView bringSubviewToFront: does * not * bring view to front
- 4. Problema con el problema Project Euler 18
- 5. Problema de Entity Framework Calculated Problema
- 6. Problema de SQLite Problema con las guías
- 7. SVN problema
- 8. problema matriz_diff
- 9. problema autotest
- 10. Character.getNumericValue() problema
- 11. preg_replace_callback() problema
- 12. problema # interruptor
- 13. FrameworkElement.Name problema
- 14. INotifyPropertyChanged problema
- 15. sprintf_s problema
- 16. FactoryGirl problema
- 17. Problema con los permisos de MySQL: debería ser un problema
- 18. problema del estadio: Proporcione un algoritmo para resolver el problema
- 19. Problema File.WriteAllText y File.Copy
- 20. PHP unserialize problema
- 21. LLVM - vinculación problema
- 22. Double.Parse - Problema de internacionalización
- 23. UpdatePanel, Repeater, DataBinding Problema
- 24. MYSQL INSERT SELECCIONAR problema
- 25. jQuery + parseDoble problema
- 26. SQL "GROUP BY" problema
- 27. C# winforms: graphics.DrawImage problema
- 28. Problema con subprocess.call
- 29. Point cubriendo problema
- 30. Problema de video HTML5
trabajo fino ... gran código! –
haciendo esto de forma recursiva sería aún mejor –
@PizzaiolaGorgonzola Para los niveles de anidación arbitrarias, sí, un método recursivo sería el camino a seguir. Sin embargo, para este caso simple sería excesivo. – DarkDust