如何删除iOS 9上的popovers背后的阴影?

Jor*_*n H 11 popover uipopovercontroller ios ios9

在iOS 8中,弹出窗口没有阴影.现在在iOS 9中,有一个非常沉重且影响深远的阴影,在纯白色背景上看起来不太理想.如何去除阴影,而是在弹出窗口周围添加一条细细的灰色线条?或者至少减少或减轻.

这在显示操作表,使用该视图控制器.Popover UIModalPresentationStyle以及可能在其他上下文中呈现视图控制器时发生.

Popover segue: 在此输入图像描述

行动表:

UIActionSheet(title: "Title", delegate: nil, cancelButtonTitle: "Cancel", destructiveButtonTitle: "Destroy").showInView(sender as! UIView)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Nis*_*ant 9

您可以使用自定义弹出窗口背景 UIPopoverBackgroundView

initWithFrame您的UIPopoverBackgroundView实现中,您可以使用a [UIColor clearColor作为投影.

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        self.layer.shadowColor = [[UIColor clearColor] CGColor];
    }

    return self;
}
Run Code Online (Sandbox Code Playgroud)

  • 奇怪的是,颜色似乎是您可以更改的唯一属性。我也尝试将其他阴影属性如半径,不透明度等更改为无效 (2认同)