Latest 0.1.0
Homepage https://github.com/CodeGeekXu/CGPopoverController
License MIT
Platforms ios 8.0
Authors

a Object-C popover controller

CI Status
Version
License
Platform

Demo

jpeg

jpeg

Installation

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

pod 'CGPopoverController'

Example

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

Usage

    // TableView popover
    NSArray *items = @[@"橘子",@"香蕉",@"苹果",@"菠萝"];
    CGPopoverTableController *popover = [[CGPopoverTableController alloc]initWithItems:items];
    popover.rowHeight = 35;
    popover.popoverContentSize = CGSizeMake(90, 35*items.count);
    popover.permittedArrowDirections = UIPopoverArrowDirectionUp;
    popover.didSelectRowBlock = ^(NSIndexPath *indexPath) {

    };
    [popover presentPopoverFromController:self barButtonItem:barButtonItem];

    // Custom popover
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 200, 45)];
    label.textColor = [UIColor redColor];
    label.font = [UIFont systemFontOfSize:12];
    label.numberOfLines = 0;
    label.text = @"自定义气泡,你可以使用自定义view来显示气泡";

    UIView *contentView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 230, 45)];
    contentView.backgroundColor = [UIColor whiteColor];
    [contentView addSubview:label];

    CGPopoverController *popover = [[CGPopoverController alloc]initWithContentView:contentView];
    popover.permittedArrowDirections = UIPopoverArrowDirectionUp;
    [popover presentPopoverFromController:self sourceView:sender
                               sourceRect:sender.bounds];

Author

CodeGeekXu, [email protected]

License

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

Latest podspec

{
    "name": "CGPopoverController",
    "version": "0.1.0",
    "summary": "A iOS popover view controller.",
    "description": "A iOS Object-C popover view controller",
    "homepage": "https://github.com/CodeGeekXu/CGPopoverController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "[email protected]": "[email protected]"
    },
    "source": {
        "git": "https://github.com/CodeGeekXu/CGPopoverController.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "CGPopoverController/Classes/**/*"
}

Pin It on Pinterest

Share This