YLFPopoverBackgroundView 0.1.4

YLFPopoverBackgroundView 0.1.4

leavesster 维护。



  • leavesster

YLFPopoverBackgroundView

CI Status Version License Platform

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

如何使用

像平常一样使用 UIPopoverPresentationController,只需添加以下代码:

vc.popoverPresentationController.popoverBackgroundViewClass = [YLFPopoverNoShadowBackgroundView class];

@import YLFPopoverBackgroundView;
...

- (void)showPopoverViewController:(UIViewController *)vc sourceView:(UIView *)sourceView
{
    vc.preferredContentSize = CGSizeMake(100, 60);
    vc.view.backgroundColor = [UIColor brownColor];
    
    vc.modalPresentationStyle = UIModalPresentationPopover;
    UIPopoverPresentationController *present = vc.popoverPresentationController;
    // just one line code
    vc.popoverPresentationController.popoverBackgroundViewClass = [YLFPopoverNoShadowBackgroundView class];
    present.delegate = self;
    present.sourceView = sourceView;
    present.sourceRect = sourceView.bounds;
    [self presentViewController:vc animated:YES completion:nil];
}

要求

对于 UIPopoverPresentationController,您需要 iOS 8+,但对于 UIPopoverController,您只需要 iOS 5+。

安装

YLFPopoverBackgroundView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:

pod 'YLFPopoverBackgroundView'

作者

leavesster

许可证

YLFPopoverBackgroundView开源许可协议为MIT类型。有关更多信息,请参阅LICENSE文件。