简体   繁体   English

iPad 3 shouldRasterize = YES使UILabel文本被切断

[英]iPad 3 shouldRasterize = YES makes UILabel text cut off

I have a problem when setting shouldRasterize to YES on layer. 在层shouldRasterize设置为YES时出现问题。 On iPad3, the label.text has the text cut off from the bottom for about 1/5 of the size. 在iPad3上,label.text的文字从底部切下约1/5的大小。 Anyone know what's the problem is?. 任何人都知道问题是什么?

    cellview.layer.cornerRadius = 12.0;
    cellview.layer.borderColor = [UIColor blackColor].CGColor;
    cellview.layer.borderWidth = 1.0;
    cellview.layer.frame = rect;
    cellview.layer.shouldRasterize =YES;
    cellview.layer.masksToBounds = YES;

On iPad 2, it works fine. 在iPad 2上,它工作正常。

设置光栅化的比例,因为iPad3的视网膜显示:

[cellview.layer setRasterizationScale:[[UIScreen mainScreen] scale]];

Swift版本:

cellview.layer.rasterizationScale = UIScreen.main.scale

Swift 4版

cellView.layer.rasterizationScale = UIScreen.main.scale

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM