“Renders with edge antialiasing” causes delay in UIAlertView in iOS 7

有些话、适合烂在心里 提交于 2020-05-10 04:16:29

问题


Ever since iOS 7, I noticed my UIAlertViews show with a sort of drawing delay- what happens is the screen dims and the UIAlertView's text appears on the screen for just a split second before the actual frame of the alert view appears.

I traced the problem to being due to the "Renders with edge antialiasing" flag set to YES in my application plist file. Turning this off solves the problem (but then I have ugly jaggies on any rotated views, which is what I was using that flag to solve in the first place).

Anyone know how I can have my cake and eat it too? i.e. have edge antialiasing as well as smooth UIAlertViews.

EDIT: On a high level, it seems as though either being able to toggle 'UIViewEdgeAntialiasing' on the fly would do it. Or if there is a way to rotate UIViews with antialiasing directly. Are either of these possible?


回答1:


"Renders with edge antialiasing" is very expensive! Use with caution.

Use this little trick instead:

    view.layer.borderWidth = 1;
    view.layer.borderColor = [UIColor clearColor].CGColor;
    view.layer.rasterizationScale = [UIScreen mainScreen].scale;
    view.layer.shouldRasterize = YES;


来源:https://stackoverflow.com/questions/19960108/renders-with-edge-antialiasing-causes-delay-in-uialertview-in-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!