Radu Matei Radu Matei - 1 month ago 15
Objective-C Question

Scale an UIView except one of its subview

I'm scaling an

UIView
this way:

myView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);


and the view is scaled well, but I want one of its subview to remain unscaled, i.e fullscreen. How to achieve this?

Avt Avt
Answer

The only way is to add additional scaling for specific subview

myView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
specific.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1./0.9, 1./0.9);

probably you will also need to add

myView.clipsToBounds = NO;
Comments