我尝试过的:我最接近的是创建一个具有以下内容的自定义segue:
- (voID)perform{ __block UIVIEwController *src = (UIVIEwController *) self.sourceVIEwController; __block UIVIEwController *dst = (UIVIEwController *) self.destinationVIEwController; CATransition* Transition = [CATransition animation]; Transition.duration = .50; Transition.timingFunction = [camediatimingFunction functionWithname:kcamediatimingFunctionEaseInEaSEOut]; Transition.type = kCATransitionMoveIn; Transition.subtype = kCATransitionFromright; [src.navigationController.vIEw.layer addAnimation:Transition forKey:@"SwitchToVIEw1"]; [src.navigationController pushVIEwController:dst animated:NO];}
这实现了我想要的动画,但它涵盖了整个第一个VIEwController.我怎么能让它停在某一点而不是覆盖整个东西?
我正在使用Storyboards,这是我第一次尝试任何类型的新动画.
解决方法 您可以尝试在源视图控制器中执行此 *** 作,并更改destnation(x轴)的框架,例如:- (voID) perform { UIVIEwController *dst = (UIVIEwController *) self.destinationVIEwController; [dst.vIEw setFrame:CGRectMake(160,YOUR_DST_WIDTH,YOUR_DST_HEIGHT)]; //your animation stuff... [self addChildVIEwController:dst]; [self.vIEw addSubvIEw:dst.vIEw]; [dst dIDMovetoParentVIEwController:self]; }
这应该做到!
如果没有,请告诉我……
UPDATE !:
@CaptJak嘿,对不起,没有为你工作..我写了下面的代码,它在这里没有任何问题..我把它链接到按钮点击..尝试它让我知道! (PS:我也添加了动画!).
VIEwController *tlc = [self.storyboard instantiateVIEwControllerWithIDentifIEr:@"MainVIEwController"];[tlc.vIEw setFrame:CGRectMake(-320,self.vIEw.frame.size.wIDth,self.vIEw.frame.size.height)];[self addChildVIEwController:tlc];[self.vIEw addSubvIEw:tlc.vIEw];[tlc dIDMovetoParentVIEwController:self];[UIVIEw animateWithDuration:0.3 animations:^{ [tlc.vIEw setFrame:CGRectMake(-160,self.vIEw.frame.size.height)];}];总结
以上是内存溢出为你收集整理的ios – UIViewController半屏“抽屉幻灯片”动画全部内容,希望文章能够帮你解决ios – UIViewController半屏“抽屉幻灯片”动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)