UIView: performance / memory difference between alpha: 0, hidden: YES, removeViewFromSuperview and frame.origin.y = -100000;

What is best for the device when temporarily hiding the view (for example, until the download is complete)?

  • Setting alpha to 0?
  • Is the setting hidden for YES?
  • Removing a view from a supervisor?
  • Moving a view to a position that makes it impossible to see in a window / screen (for example, frame.origin.y = -10000)?

Which is better in terms of memory and what is better in terms of performance? I know that Apple wrote about this somewhere, but I cannot find it.

+4
source share
2 answers

Which is better in terms of memory

removeFromSuperview . ? , . , - (, ivar), .

?

setHidden: . ? - . drawRect BOOL. , .

+7

, :

  • setHidden ( )
  • alpha 0 setHidden, but it first checks if 0`
  • removeFromSuperView ( : , (), ...)
  • frame.origin.y=-10000 > , . ...
+3

Source: https://habr.com/ru/post/1526536/


All Articles