탭 모음에서 표시되는 아이콘 메뉴를 만들었습니다. 이 메뉴는 세로 또는 가로로 볼 수 있습니다.UIView를 애니메이션화하여 크로스 페이드 효과가 제대로 작동하지 않음
화면의 공간 때문에 나는 초상화로 당신이 4x4 아이콘을 볼 수있게 만들었습니다. 그러나 조경으로 보았을 때 크기 조정으로 인해 잘 작동하지 않았습니다. 그래서 나는 그것을 만들었습니다. 이 때문에 6 행 2와 4 행 1을 볼 수 있습니다. 두 개의 UIView를 만들려고 결정했습니다. 두 개의 뷰 사이에서 장치가 회전 할 때 회전합니다.
즉 세로 방향 현재 및 기기가 회전 된 경우 가로 방향으로로드하고 세로 방향을 언로드합니다.
이 나는 장치 회전에서보기를 변경하기 위해 사용하고있는 코드가,이 완벽하게 잘 작동입니다 (가장 좋은 코드가되지 않을 수도 있지만 내가 할 수있는 최선의)
if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait)
{
if([jumpBarContainerLandscape superview])
{
// Device is changing from landscape to protrait change views to fit
// load landscape view
jumpBarContainerPortrait = [[UIView alloc] initWithFrame:CGRectMake(0.0, (367 - jumpBarHeightPortrait), 320.0, (jumpBarHeightPortrait + 49.0))];
jumpBarContainerPortrait.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
jumpBarContainerPortrait.alpha = 0.0;
// add jumpbar container to view
[self.view insertSubview:jumpBarContainerPortrait belowSubview:actionTabBar];
[UIView animateWithDuration:0.2
delay:0.0f
options:UIViewAnimationCurveEaseIn
animations:^{
jumpBarContainerLandscape.alpha = 0.0;
} completion:^(BOOL finished) {
if (finished) {
}
}];
[UIView animateWithDuration:0.2
delay:0.0f
options:UIViewAnimationCurveEaseIn
animations:^{
jumpBarContainerPortrait.alpha = 1.0;
} completion:^(BOOL finished) {
if (finished) {
// remove subView for superView
[jumpBarContainerLandscape removeFromSuperview];
}
}];
}
}
else if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight)
{
if ([jumpBarContainerPortrait superview])
{
// Device is changing from portrait to landscape change views to fit
// load landscape view
jumpBarContainerLandscape = [[UIView alloc] initWithFrame:CGRectMake(0.0, (207 - jumpBarHeightLandscape), 480.0, (jumpBarHeightLandscape + 49.0))];
jumpBarContainerLandscape.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
jumpBarContainerLandscape.alpha = 0.0;
// add jumpbar container to view
[self.view insertSubview:jumpBarContainerLandscape belowSubview:actionTabBar];
// fade out
[UIView animateWithDuration:0.2
delay:0.0f
options:UIViewAnimationCurveEaseIn
animations:^{
jumpBarContainerPortrait.alpha = 0.0;
} completion:^(BOOL finished) {
if (finished) {
}
}];
// fade in
[UIView animateWithDuration:0.2
delay:0.0f
options:UIViewAnimationCurveEaseIn
animations:^{
jumpBarContainerLandscape.alpha = 1.0;
} completion:^(BOOL finished) {
if (finished) {
// remove subView for superView
[jumpBarContainerPortrait removeFromSuperview];
}
}];
}
}
지금 문제 나는 두 UIView 사이의 애니메이션이 매우 못생긴다는 것은 매우 부드럽지 만 바람직하지 않은 애니메이션 등의 두 가지 다른 뷰를 볼 수 있습니다. 두 사람이 크로스 페이드하는 좋은 방법을 생각할 수 있는지 궁금합니다. 그것은 abit 부드럽게 보이 ...
어떤 도움을 주시면 대단히 감사하겠습니다.
는 편집 :
그래서 난 그냥 그러나 내가 한 줄에 오류가 '있는 UIView'에 대한 눈에 띄는 @ 인터페이스가 선택 'jumpBarContainerPortrait'를 선언하지 날이 오류를 제공해야하는 CATransaction를 만들기 위해 노력했다 나는 UIView의 방법 "transitionFromView"를 사용, 나는에 .. 어떤 도움을 주시면 감사하겠습니다
[CATransaction begin];
CATransition *animation = [CATransition animation];
animation.type = kCATransitionFade;
animation.duration = 3.50;
[self.view insertSubview:jumpBarContainerPortrait belowSubview:actionTabBar];
[[self.view jumpBarContainerPortrait] addAnimation:animation forKey:@"Fade"]; // Error is happening here!
[CATransaction commit];
대신 'kCATransitionFade' 유형으로'CATransition '을 사용해 보았습니까? – sooper