tipsywacky
tipsywacky

Reputation: 3464

iPad 3 shouldRasterize = YES makes UILabel text cut off

I have a problem when setting shouldRasterize to YES on layer. On iPad3, the label.text has the text cut off from the bottom for about 1/5 of the size. 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.

Upvotes: 8

Views: 2344

Answers (3)

Arsen
Arsen

Reputation: 10951

Swift version:

cellview.layer.rasterizationScale = UIScreen.main.scale

Upvotes: 3

Omer Celik
Omer Celik

Reputation: 319

Swift 4 version

cellView.layer.rasterizationScale = UIScreen.main.scale

Upvotes: 1

Templar
Templar

Reputation: 1694

Set the rasterization's scale, because of iPad3's retina display:

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

Upvotes: 23

Related Questions