【问题标题】:Add new view with specific Segue transition添加具有特定 Segue 转换的新视图
【发布时间】:2012-01-16 06:39:25
【问题描述】:
PinViewController *k_View = [[PinViewController alloc] initWithNibName:@"PinViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:k_View];
[self presentViewController:navigationController animated:YES completion: nil];
NSString *addr = sender.titleLabel.text;
[k_View showPinView:addr];

这是我的代码。新视图是以编程方式添加的,所以我不能只使用 GUI 来选择我想要的 segue 效果类型。我想使用使用过渡“Cross Disolve”的 Segue,我将如何在代码中执行此操作?

谢谢!

【问题讨论】:

    标签: iphone ios ipad ios5


    【解决方案1】:

    您不需要任何转场。只需添加:

    navigationController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    

    在调用 presentViewController:animated:completion: 之前,它应该可以解决问题。 请参阅UIViewController reference 中的 modalTransitionStyle 和 modalPresentationStyle。

    【讨论】:

    • 非常感谢!效果很好!对不起,我不能给你投票(我的名声还不够好)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-16
    • 2012-06-29
    • 2021-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-13
    相关资源
    最近更新 更多