Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CALayer auto resizing in iOS on device orientation change

I have added one more CALayer for Custom View ,The code is

hostedGraphLayer.frame = self.layer.bounds;
[self.layer addSublayer:hostedGraphLayer];

When device orientation changes view's layer's sublayer also rotated but it is not autoresizing with respect to view. Layer wont have autoresize property for iOS.

One of the answer already in stackOverFlow is CALayers didn't get resized on its UIView's bounds change. Why? In this case setting layer's frame on device orientation change ,layer wont autoresize with respect to its view in between rotation start and end, this can be seen clearly in simulator by toggling slow animation.

Is there any fix for this "When view is rotated its layers also get rotated and it should resize w.r.t its view".

like image 300
Yatheesha Avatar asked Mar 10 '14 05:03

Yatheesha


1 Answers

No there is not built in fix for that Yet,

You have to change its frames .

correct me if i am wrong.

like image 133
Toseef Khilji Avatar answered Nov 11 '22 09:11

Toseef Khilji