5
UIView 슬라이드를 페이지의 4 분의 1 위로 이동하여 그 아래에 다른보기를 표시 한 다음 (옵션을 표시하기 위해) 뒤로 이동하여 해당 옵션을 덮습니다. 나는 끊임없이 그렇게 수색했지만 찾고있는 것을 찾을 수없는 것 같습니다. 화면에서 최상위보기를 유지하려면 모달보기를 사용하고 싶지 않습니다. 아래의 코드에서는 일종의 작업을 수행하고 최상위 레벨은 위로 슬라이드하지만 완전히 사라집니다 (페이드 아웃).kCATransitionPush를 사용하여 UIView 슬라이드하기
도움을 주시면 대단히 감사하겠습니다.
감사합니다.
HomeOptionsViewController *homeOptionsViewController = [[HomeOptionsViewController alloc]
initWithNibName:@"HomeOptionsViewController"
bundle:nil];
// get the view that's currently showing
UIView *currentView = self.view;
// get the the underlying UIWindow, or the view containing the current view
UIView *theWindow = [currentView superview];
UIView *newView = homeOptionsViewController.view;
//newView.frame = CGRectMake(0,300, 320,140);
newView.frame = CGRectMake(0,-10, 320,140);
// remove the current view and replace with myView1
//---[currentView removeFromSuperview];
[theWindow addSubview:newView];
theWindow.frame = CGRectMake(0,-110,320,200);
newView.frame = theWindow.bounds;
// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromTop];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
//[theWindow setFrame:CGRectMake(0,200,320,300)];
[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
감사합니다. Mishie. 특별히 내가 더 잘 모른다는 말 이외의 다른 이유는 없습니다. 표준 UIView를 사용하도록 코드를 시도했지만 여전히 원하는 효과를 제공하지 않습니다. theWindow보기가 위로 미끄러지지만 newView는 화면 맨 위에, Windows보기 위에 나타나고 아래로 내려갑니다. 위 윈도우 뷰가 위로 움직이게하고 newView가 아래쪽에 나타나도록하고 싶습니다. 표준 UIView를 사용하여 애니메이션을 제어하려면 어떻게해야합니까? 감사! – Doug
프레임 좌표를 올바르게 설정하기 만하면됩니다. 귀하의 newView의 시작 프레임이 무엇인지 잘 모르겠습니다. 그래서 저는 단지 짐작했습니다 =) – MishieMoo
Mishie에게 다시 한번 감사드립니다. 이것은 효과가있다. – Doug