无法更改 Xcode (iPad) 中模式视图的呈现和过渡样式

发布于 2024-12-09 08:04:28 字数 417 浏览 1 评论 0原文

我目前在模态视图和弹出窗口方面遇到一些问题。这可能是同样的问题,但我不确定。

我在模态视图中遇到的问题是我无法更改动画或过渡样式。例如,我编写了内容

self.modalPresentationStyle = UIModalPresentationPageSheet;
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:IpModal animated:YES];

,但模态视图仍然以其原始过渡样式全屏显示。

另外,我遇​​到的弹出窗口问题非常相似。即使我使用“NO”作为参数调用missPopover:animated:方法,过渡仍然是动画的。

提前致谢。

I'm currently having some trouble with modal views and popovers. It might be the same problem, but I'm not sure.

The problem I'm having with modal views is that I can't change the animation or transition style. For instance, I write

self.modalPresentationStyle = UIModalPresentationPageSheet;
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:IpModal animated:YES];

but the modal view still appears full screen with its original transition style.

Also, the problem I'm having with popovers is pretty similar. Even though I call the dismissPopover:animated: method with "NO" as the parameter, the transition is still animated.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

苹果你个爱泡泡 2024-12-16 08:04:28

modalPresentationStylemodalTransitionStyle 适用于要以模态方式呈现的视图控制器,而不是执行呈现的控制器。

你的代码应该是

IpModal.modalPresentationStyle = UIModalPresentationPageSheet;
IpModal.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:IpModal animated:YES];

modalPresentationStyle and modalTransitionStyle apply to the view controller that is to be presented modally, not the controller doing the presenting.

Your code should be

IpModal.modalPresentationStyle = UIModalPresentationPageSheet;
IpModal.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:IpModal animated:YES];
深海夜未眠 2024-12-16 08:04:28

我在自定义转场中这样做了。

UIViewController* src = self.sourceViewController;
UIViewController* dst = self.destinationViewController;

src.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal;
dst.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal;
[src presentModalViewController:dst animated:YES];

I did this in custom segue.

UIViewController* src = self.sourceViewController;
UIViewController* dst = self.destinationViewController;

src.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal;
dst.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal;
[src presentModalViewController:dst animated:YES];
Oo萌小芽oO 2024-12-16 08:04:28
#import yourViewController.m //already present
#import destinationVieController.m //to be added by programmer

//custom function to call destination controller

-(void)callDestinationViewController{

    destinationViewController *dest = [[destinationViewController alloc] initWithNibName:@"destinationViewController" bundle:nil];

    dest.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:dest animated:YES];

  }

//custom function can be called on event fire or action call

希望这有帮助!

#import yourViewController.m //already present
#import destinationVieController.m //to be added by programmer

//custom function to call destination controller

-(void)callDestinationViewController{

    destinationViewController *dest = [[destinationViewController alloc] initWithNibName:@"destinationViewController" bundle:nil];

    dest.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:dest animated:YES];

  }

//custom function can be called on event fire or action call

Hope This Helps !

烛影斜 2024-12-16 08:04:28

也许您可以尝试使用这两种方法之一来呈现弹出窗口控制器,具体取决于您希望它出现的位置,而不是 presentModalViewController:animated:

– presentPopoverFromRect:inView:permittedArrowDirections:animated:
– presentPopoverFromBarButtonItem:permittedArrowDirections:animated:

Perhaps you could try using one of these two methods to present the popover controller, depending on where you want it to appear, rather than presentModalViewController:animated:.

– presentPopoverFromRect:inView:permittedArrowDirections:animated:
– presentPopoverFromBarButtonItem:permittedArrowDirections:animated:
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文