UIView group opacity in single view heirachy

后端 未结 2 366
予麋鹿
予麋鹿 2021-01-02 15:17

I am writing a UI library in which i would like to be able to have the alpha of the UIViews as if the UIViewGroupOpacity info.plist ket was set. See following links:

<
2条回答
  •  迷失自我
    2021-01-02 15:53

    Yes there is, you can set shouldRasterize of the view's layer.

    containerView.layer.shouldRasterize = YES;
    // Not setting rasterizationScale, will cause blurry images on retina displays:
    containerView.layer.rasterizationScale = [[UIScreen mainScreen] scale];
    

    This will have the same effect as UIViewGroupOpacity but only for containerView and it's subviews.

提交回复
热议问题