【问题标题】:View Transparency issue in ios7 while presenting modalViewController显示 modalViewController 时在 ios7 中查看透明度问题
【发布时间】:2016-05-19 00:41:50
【问题描述】:

我有一个应用程序,我在其中使用 presentViewController 从一个视图导航到另一个视图。

我有一个视图控制器,其中我已将视图的背景颜色设置为清除颜色。

在我的 XIB 中,我有一个高度为 200 像素的视图,在呈现此视图时,我只想显示此视图,其余部分应该是透明的。

为此,我使用以下代码。

view.modalPresentationStyle = UIModalPresentationStyle.Custom;

这在 ios7 上运行良好,但不适用于 ios7。

我搜索了很多,但没有一个对我有用。

请帮帮我。

我们将不胜感激。

谢谢..

【问题讨论】:

    标签: objective-c xcode ios7 presentmodalviewcontroller presentviewcontroller


    【解决方案1】:

    来自raywenderlich的论坛链接, 您需要呈现 Viewcontroller 之类的,

    在 iOS 8 之前,您可以这样做:

    [backgroundViewController setModalPresentationStyle:UIModalPresentationCurrentContext];
    [backgroundViewController presentViewController:_myMoreAppsViewController animated:NO completion:nil];
    

    在 iOS 8 中,您必须这样做:

    backgroundViewController.providesPresentationContextTransitionStyle = YES;
    backgroundController.definesPresentationContext = YES;
    [overlayViewController setModalPresentationStyle:UIModalPresentationOverCurrentContext];
    

    将您的控制器设置在 backgroundViewController 的位置。 我希望它对你有帮助。

    【讨论】:

      【解决方案2】:

      不要在 XIB 中查看视图,而是在故事板中使用 200 像素视图的视图控制器,然后将故事板中的呈现更改为“超过当前内容”将为您提供完全透明的效果,除了 200 像素部分,这是图像.

      http://i.stack.imgur.com/9ZW6U.png

      使用 segue 呈现此视图控制器的模型。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-08-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-19
        • 2017-09-29
        • 2013-01-24
        • 2013-06-21
        相关资源
        最近更新 更多