【发布时间】:2013-12-10 15:16:10
【问题描述】:
我有一个正常工作的页面卷曲。问题是 iPad 的旋转。该应用程序仅在横向运行,并支持 l 左和 l 右。如果 iPad 是“横向”,则卷曲应该发生在右下角。如果我旋转 iPad,视图会按预期旋转,但现在当我尝试卷曲发生在左上角时。我添加了一条通知,告诉我它何时旋转并尝试更改动画子类型但没有骰子。
-(IBAction)curlViewUp
{
uiv_help.alpha = 1.0;
[UIView animateWithDuration:1.0
animations:^{
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.7];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
animation.type = @"pageCurl";
animation.subtype = curlDirection;
animation.fillMode = kCAFillModeForwards;
animation.endProgress = 0.20;
[animation setRemovedOnCompletion:NO];
[self.view.layer addAnimation:animation forKey:@"pageCurlAnimation"];
[self.view addSubview:uiv_help];
;}
];
}
-(IBAction)curlViewDown
{
uiv_help.alpha = 0.0;
[UIView animateWithDuration:1.0
animations:^{
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.7];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
animation.type = @"pageUnCurl";
animation.subtype = curlDirection;
animation.fillMode = kCAFillModeForwards;
animation.startProgress = 0.80;
[animation setRemovedOnCompletion:YES];
[self.view.layer addAnimation:animation forKey:@"pageUnCurlAnimation"];
//[self.view removeFromSuperview];
[uiv_help removeFromSuperview];
;}
];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft | interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
-(void)checkRotation:(NSNotification*)notification
{
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if(orientation == UIInterfaceOrientationLandscapeLeft)
{
NSLog(@"UIInterfaceOrientationLandscapeLeft");
curlDirection = @"fromRight";
} else if (orientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"UIInterfaceOrientationLandscapeRight");
curlDirection = @"fromRight";
}
}
【问题讨论】:
-
我觉得肯定是uikit bug什么的……
-
复制到 StackOverflow 时可能只是一个错字,但这里显示 curlDirection = @"fromRight" 方向是左还是右。
-
为什么人们在不打算跟进的情况下提供赏金?
-
@AustinMullins,如果你能看看我对这个问题的回答,如果你同意给它投票,我将不胜感激。 OP和赏金提供者似乎都放弃了这个问题。我提供了一个详细的、有用的、正确的答案(经过测试),它会迷失和忽略......谢谢
-
@HeWas ???距离发布答案只有一天 - 从那以后我没有打开我的电脑。我很高兴获得赏金。