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 SQLite Problema con las guías
- 6. Problema de Entity Framework Calculated Problema
- 7. FactoryGirl problema
- 8. problema # interruptor
- 9. sprintf_s problema
- 10. INotifyPropertyChanged problema
- 11. SVN problema
- 12. problema matriz_diff
- 13. preg_replace_callback() problema
- 14. FrameworkElement.Name problema
- 15. Character.getNumericValue() problema
- 16. problema autotest
- 17. Problema con los permisos de MySQL: debería ser un problema
- 18. problema del estadio: Proporcione un algoritmo para resolver el problema
- 19. Double.Parse - Problema de internacionalización
- 20. BigDecimal Problema en java
- 21. UpdatePanel, Repeater, DataBinding Problema
- 22. IE8 XSS/Jquery problema
- 23. Problema File.WriteAllText y File.Copy
- 24. El problema de partición
- 25. Un problema sobre in_array
- 26. inexplicable Mathematica7 DumpSave [] problema
- 27. problema con DateTime.ToOADate()
- 28. referencias en C++ problema
- 29. Problema al utilizar gema
- 30. Android ListView Selección Problema
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