1
我使用下面的非常基本的代码,我想学习如何做转换适合初学者基本横向旋转CATransform3DMakeRotation似乎只用来工作
我想要做的长的第二次的方式来学习不仅仅是在“shouldautorotate”扔东西更多,这是我工作过的现在
- (void)viewDidLoad
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
}
- (void)didRotate:(NSNotification *)notification
{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIDeviceOrientationLandscapeRight)
{
[UIView animateWithDuration:0.2f animations:^{
self.view.layer.transform = CATransform3DMakeRotation(-M_PI/2, 0, 0.0, 1.0);
[self.scrollViewImages setContentSize:CGSizeMake(self.view.frame.size.width*self.images.count, 320.0)];
[self.scrollViewImages setContentOffset:CGPointMake(0, 0) animated:YES];
} completion:^(BOOL finished) {
}];
} else if(orientation == UIDeviceOrientationPortrait) {
[UIView animateWithDuration:0.2f animations:^{
self.view.frame = CGRectMake(0, 0, 320.0, 480.0);
self.view.center = CGPointMake(160.0, 240.0);
self.view.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished) {
}];
}
}
代码但是我第一次从纵向旋转,我得到这个
但一旦我把它恢复到肖像和旋转,我再次receieve
我真的很抱歉,如果这是一个愚蠢的问题还是我失去了一些东西明显。我一直在我的帮助下学习自己:)
感谢您的任何帮助,有一个很好的家伙。