【问题标题】:change transition of navigationcontroller ios更改导航控制器 ios 的转换
【发布时间】:2013-12-21 06:17:52
【问题描述】:

在典型的视图控制器转换中,消失和出现视图都在移动,但是现在我想创建一个自定义动画,您可以在其中引发事件以更改视图,该视图将消失,只是隐藏而没有过渡和动画,并且视图将继续以相同的过渡出现。 那么这里的问题是我有导航栏,我不知道,如何创建导航栏的自定义过渡?, 你能帮我知道如何更改或删除导航控制器的转换。

我试过了,但它只添加了其他过渡,并没有删除基本过渡。

对于推送:

MainView *nextView = [[MainView alloc] init];
[UIView animateWithDuration:0.75
                 animations:^{
                                 [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                                 [self.navigationController pushViewController:nextView   animated:NO];
                                 [UIView     setAnimationTransition:UIViewAnimationTransitionFlipFromRight    forView:self.navigationController.view cache:NO];
                             }];

对于流行音乐:

[UIView animateWithDuration:0.75
                 animations:^{
                                 [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                                 [UIView setAnimationTransition:transition  forView:self.navigationController.view cache:NO];
                             }];
[self.navigationController popViewControllerAnimated:NO];

有什么想法吗?谢谢 :D

【问题讨论】:

    标签: ios objective-c xcode uinavigationcontroller


    【解决方案1】:

    您可以只使用添加作为子视图并使用标题栏来模仿导航控制器。

    MainView *nextView = [[MainView alloc] init];
    //setup frame 
    nextView.view.frame = xxx;
    [self.view addSubview:nextView.view];
    

    使用[nexView.view removeFromSuperView];删除

    只需在当前视图上方添加一些默认隐藏的视图,并在某些操作上设置隐藏 NO,或者如果您想将视图保持在下方并在某些操作上置于前面,请调用 bringSubviewFront 方法。

    【讨论】:

    • 感谢您的评论,在每个视图中我可以将它放在哪里?还是在视图导航控制器中?当你说 nextView.view.frame = xxx; xxx 是一个 CGRect()?
    • 如果您只想在当前视图中显示“nextView”,则在视图中显示“是”。但如果它要在其他地方使用,也要使用导航控制器。并隐藏导航标题栏。是 xxx CGRect()
    猜你喜欢
    • 2019-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-06
    • 2015-08-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多