开发者

uiview rotation reset size problem

开发者 https://www.devze.com 2023-02-03 08:38 出处:网络
I have UIView that i\'m rotating left and right.I\'m using CGAffineTransform but the problem is view frame is not changing.

I have UIView that i'm rotating left and right.I'm using CGAffineTransform but the problem is view frame is not changing.

My code is like this:

CGAffineTransform tRotate45 = CGAffineTransformMakeRotation(-1.57);
self.view.transform = tRotate45;
imageScrollView.contentSize = CGSizeMake(480, 320);

self.view.frame =[[UIView alloc] ] CGRectMake(0, 0, 480, 3开发者_高级运维20);

The view is transforming properly but the frame remains the same. what is the problem?


There is a problem in the view transform or orientation. You can orient like this:

You have to rotate all content of that page instead of rotating just the view:

CGAffineTransform tRotate45 = CGAffineTransformMakeRotation(M_PI *
0.00); 
imageScrollView.transform = tRotate45; 
BackBtn.transform=tRotate45; 
BackBtn.frame = CGRectMake(7, 5, 67, 32 ); 
imageScrollView.contentSize = CGSizeMake(320, 418); 
imageScrollView.frame = CGRectMake(0, 44, 320,418 );

You can find values of M_PI here: http://chris-software.com/index.php/tag/transformation/

0

精彩评论

暂无评论...
验证码 换一张
取 消