search

Home  >  Q&A  >  body text

ios - alpha=0 clearColor hidden=YES 有什么区别

需要临时隐藏一个应用的时候,可能会用到三种办法

view.alpha=0.f;
view.backgroundColor=[UIColor clearColor];
view.hidden=YES;

这三种方法到底有什么区别?从性能上考虑
另外,如果我希望他小时的时候是渐隐的,效率最好的方法是什么?

高洛峰高洛峰2886 days ago704

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 11:23:46

    The literal difference is that view is transparent, the background color of the view is transparent and the entire view is hidden
    From a performance point of view, hiding is better, because if it is transparent, the GPU needs to calculate the contents of two layers of views before displaying it

    The method of fading is to go from alpha from 1 to 0, and then hide

    reply
    0
  • Cancelreply