the_critic
the_critic

Reputation: 12820

Setting affine transform on NSView layer not working as on iOS

I am trying to achieve something very simple. I would like to transform a layer's scale. However it does not seem to work as expected. In fact, it does not work at all. The layer's scale remains the same.

Here is my code:

NSView *v = [[NSView alloc]init];
v.wantsLayer = YES;
v.frame = self.bounds;
float scale = 0.8f;
[v.layer setAffineTransform:CGAffineTransformMakeScale(scale,scale)];
[self addSubview:v];

If I log the affineTransform property of v I get null.

Upvotes: 2

Views: 4324

Answers (1)

Unheilig
Unheilig

Reputation: 16302

Try this on OSX:

self.layer.sublayerTransform = CATransform3DMakeScale(scale, scale, 0.0f);

Upvotes: 8

Related Questions