YLFPopoverBackgroundView 0.1.4

YLFPopoverBackgroundView 0.1.4

Maintained by leavesster.



  • By
  • leavesster

YLFPopoverBackgroundView

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

How to use

use UIPopoverPresentationController as normal, just add :

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];
}

Requirements

For UIPopoverPresentationController, you need iOS 8+. But for UIPopoverController, you only need iOS 5+.

Installation

YLFPopoverBackgroundView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'YLFPopoverBackgroundView'

Author

leavesster

License

YLFPopoverBackgroundView is available under the MIT license. See the LICENSE file for more info.