Giter Site home page Giter Site logo

arspopover's People

Contributors

andrij200993 avatar soberman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

arspopover's Issues

Help:Whay's wrong with my code?

original code

    [self presentViewController:popoverController animated:YES completion:^{
        [popoverController insertContentIntoPopover:^(JKPopoverController *popover, CGSize popoverPresentedSize, CGFloat popoverArrowHeight) {

            CGFloat originX = 0;
            CGFloat originY = 0;
            CGFloat width = popoverPresentedSize.width;
            CGFloat height = popoverPresentedSize.height - popoverArrowHeight;

            CGRect frame = CGRectMake(originX, originY, width, height);

            UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
            webView.scalesPageToFit = YES;

            [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://google.com"]]];

            [popover.view addSubview:webView];
        }];
    }];

But I dont want to use the block method ,so i changed code like this

[self presentViewController:popoverController animated:YES completion:^{
        CGFloat presentationArrowHeight = 12.0;

        CGFloat width = CGRectGetWidth(self.popoverPresentationController.frameOfPresentedViewInContainerView);
        CGFloat height = CGRectGetHeight(self.popoverPresentationController.frameOfPresentedViewInContainerView);
        CGSize popoverSize = CGSizeMake(width, height);

            CGFloat originX = 0;
            CGFloat originY = 0;
            CGFloat webWidth = popoverSize.width;
            CGFloat webHeight = popoverSize.height - presentationArrowHeight;

            CGRect frame = CGRectMake(originX, originY, webWidth, webHeight);

            UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
            webView.scalesPageToFit = YES;

            [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://google.com"]]];

            [popoverController.view addSubview:webView];

Howevey, both of value of width & hight are 0 !

        CGFloat width = CGRectGetWidth(self.popoverPresentationController.frameOfPresentedViewInContainerView);
        CGFloat height = CGRectGetHeight(self.popoverPresentationController.frameOfPresentedViewInContainerView);

Could you help me ?

Layout issue when presenting on iPhone 6 Plus in landscape

If I try to present the popover form a button in landscape on iPhone 6 Plus I get a UIModalPresentationFormSheet instead of a popover and the content is not loaded.
The issue is reproducible with the demo app if you enable landscape orientation and fix the autolayout constrains of the two buttons.
Presenting in landscape on iPhone 6 and lower works.

Wrong presentation in tableView

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
        [tableView deselectRowAtIndexPath:indexPath animated:YES];
        
        ARSPopover *popoverController = [ARSPopover new];
        popoverController.sourceView = [tableView cellForRowAtIndexPath:indexPath];
        popoverController.sourceRect = [tableView rectForSection:indexPath.section];
        popoverController.contentSize = CGSizeMake(200, 100);
        popoverController.arrowDirection = UIPopoverArrowDirectionAny;
        
        [self presentViewController:popoverController animated:YES completion:^{
            [popoverController insertContentIntoPopover:^(ARSPopover *popover, CGSize popoverPresentedSize, CGFloat popoverArrowHeight) {
                CGFloat originX = 0;
                CGFloat originY = 0;
                CGFloat width = popoverPresentedSize.width;
                CGFloat height = popoverPresentedSize.height - popoverArrowHeight;
   
                CounterView *view = [CounterView new];
                [popover.view addSubview:view];
            }];
        }];
        return;
    }

2017-03-11 13 52 51

Dismissing Popover with cancel Button or OnSelectedDay

Hi! I'm having trouble dismissing it using those method. I tried to add tag on popoverController and inside the .insertContentIntoPopover and tried view.viewWithTag(calendar_tag)?.removeFromSuperview() But it seems to be not working. Thanks!

How to dismiss popover?

How to dismiss popover? There is no property to dismiss the popover If I need to dismiss it after the UITableView Row selection inside popover.

Auto Layout support?

As a very simple sample I'm trying to display a multi-line UILabel in an ARSPopover using Auto Layout to break it into multiple lines and to ensure that the popover's content size fits within the screen:

    ARSPopover *popover = [ARSPopover new];
    popover.sourceView = sourceView;
    popover.sourceRect = CGRectMake(CGRectGetMidX(sourceView.bounds), CGRectGetMaxY(sourceView.bounds), 0.0f, 0.0f);
//    popover.contentSize = CGSizeMake(200.0f, 100.0f);
    popover.arrowDirection = UIPopoverArrowDirectionUp;

    [popover insertContentIntoPopover:^(ARSPopover *popover, CGSize popoverPresentedSize, CGFloat popoverArrowHeight) {
        UILabel *label = [[UILabel alloc] init];
        label.text = @"This is a tutorial view! Let's see if this works properly.";
        label.numberOfLines = 0;
        label.textAlignment = NSTextAlignmentLeft;
        [label sizeToFit];
        [popover.view addSubview:label];

        [popover.view addConstraint:[NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:popover.view attribute:NSLayoutAttributeLeftMargin multiplier:1.0f constant:0.0f]];
        [popover.view addConstraint:[NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:popover.view attribute:NSLayoutAttributeRightMargin multiplier:1.0f constant:0.0f]];
        [popover.view addConstraint:[NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:popover.view attribute:NSLayoutAttributeTopMargin multiplier:1.0f constant:0.0f]];
        [popover.view addConstraint:[NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:popover.view attribute:NSLayoutAttributeBottomMargin multiplier:1.0f constant:0.0f]];

        [popover.view setNeedsUpdateConstraints];
        [popover.view layoutIfNeeded];
    }];

    [self presentViewController:popover animated:YES completion:nil];

However it doesn't seem like ARSPopover supports Auto Layout.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.