本文小白 仅供提醒.
注意 是视图的旋转 不是屏幕的旋转.
其实 难点就是 坐标的改变............
- (void)buttonChange:(UIButton *)button
{
self.stateBar.frame = CGRectMake(self.view.bounds.size.width - 50, self.view.bounds.origin.y, 49, self.view.bounds.size.height);
self.buttonBar.frame = CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, 44, self.view.bounds.size.height);
// toolBar 控件 创建一个新的视图
_myslider.frame = CGRectMake(- 80 + self.view.bounds.origin.x, 150, 200, 20);
_myslider.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);
_lightButton.frame = CGRectMake(self.view.bounds.origin.x + 10, 380, 30, 30);
_lightButton.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);
// light
_lightslider.frame = CGRectMake(self.view.bounds.origin.x + 100, 200, 150, 32);
_lightslider.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);
_zhanButton.frame = CGRectMake(10 + self.view.bounds.origin.x, 30, 0, 0);
//
_mylabel.frame = CGRectMake(self.view.bounds.origin.x - 20, self.view.bounds.origin.y + 250 , 100, 32);
_mylabel.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);
// 分享按钮
_sharebutton.frame = CGRectMake(self.view.bounds.origin.x + 10, self.view.bounds.origin.y + 400, 30, 30);
_sharebutton.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);
self.scrollview.contentSize = CGSizeMake(self.view.bounds.size.height, 720*self.myslider.maximumValue);
self.scrollview.contentOffset = CGPointMake(0, 720);
self.scrollview.pagingEnabled = NO;
[UIView beginAnimations:@"clockwiseAnimation" context:NULL];
[UIView setAnimationDuration:1.0f];
[UIView setAnimationDelegate:self];
//顺时针旋转90度
self.scrollview.transform = CGAffineTransformMakeRotation((90.0f * M_PI) / 180.0f);
self.scrollview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
for (UIView *aView in self.scrollview.subviews)
{
NSLog(@"aView1 = %@", NSStringFromCGRect(aView.frame));
if ((aView.tag - 1000) >= 0)
{
float orgX = aView.frame.origin.x/320 * 720;
NSLog(@"orgX = %f", orgX);
aView.frame = CGRectMake(0, orgX, self.view.bounds.size.height, 720);
NSLog(@"aView2 = %@", NSStringFromCGRect(aView.frame));
}
}
[UIView commitAnimations];
}