Latest 2.0.4
Homepage https://github.com/tichise/PopOverMenu
License MIT
Platforms ios 8.0, requires ARC

PopOverMenu CocoaPods Version Platform License

PopOverMenu is a PopOver style menu.

Image

iPhone

Examples

Swift

    public func openMenu(sender:UIBarButtonItem) {
        let titles:NSArray = ["Menu1", "Menu2", "Menu3"]
        let descriptions:NSArray = ["description1", "", "description3"]

        let popOverViewController = PopOverViewController.instantiate()
        popOverViewController.setTitles(titles: titles)
        popOverViewController.setDescriptions(descriptions: descriptions)

        // option parameteres
        // popOverViewController.setSelectRow(1)
        // popOverViewController.setShowsVerticalScrollIndicator(true)
        // popOverViewController.setSeparatorStyle(UITableViewCellSeparatorStyle.singleLine)

        popOverViewController.popoverPresentationController?.barButtonItem = sender
        popOverViewController.preferredContentSize = CGSize(width: 300, height:135)
        popOverViewController.presentationController?.delegate = self
        popOverViewController.completionHandler = { selectRow in
            switch (selectRow) {
            case 0:
                break
            case 1:
                break
            case 2:
                break
            default:
                break
            }

        };
        present(popOverViewController, animated: true, completion: nil)
    }

    func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
        return UIModalPresentationStyle.none
    }

    func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
        return UIModalPresentationStyle.none
    }

ObjectiveC

@import PopOverMenu;

-(IBAction)openMenu:(id)sender {

    NSArray *titles = @[@"Menu1", @"Menu2", @"Menu3"];
    NSArray *descriptions = @[@"description1", @"", @"description3"];

    PopOverViewController *popOverViewController = [PopOverViewController instantiate];

    [popOverViewController setTitlesWithTitles:titles];
    [popOverViewController setDescriptionsWithDescriptions:descriptions];

    popOverViewController.popoverPresentationController.barButtonItem = sender;
    popOverViewController.preferredContentSize = CGSizeMake(300, 135);
    popOverViewController.presentationController.delegate = self;

    [popOverViewController setCompletionHandler:^(NSInteger selectRow) {
        switch (selectRow) {
            case 0:
                break;
            case 1:
                break;
            case 2:
                break;
            default:
                break;
        }
    }];

    [self presentViewController:popOverViewController animated:YES completion:nil];
}

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller {
    return UIModalPresentationNone;
}

- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(UITraitCollection *)traitCollection {
    return UIModalPresentationNone;
}

Installation (CocoaPods)

pod PopOverMenu

CocoaPods URL

License

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

Latest podspec

{
    "name": "PopOverMenu",
    "version": "2.0.4",
    "license": "MIT",
    "summary": "PopOverMenu is a PopOver style menu.",
    "homepage": "https://github.com/tichise/PopOverMenu",
    "social_media_url": "http://twitter.com/tichise",
    "authors": "Takuya Ichise",
    "source": {
        "git": "https://github.com/tichise/PopOverMenu.git",
        "tag": "2.0.4"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Sources/*.swift",
    "requires_arc": true,
    "resource_bundles": {
        "Storyboards": [
            "Storyboards/*.storyboard"
        ]
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This