Giter Site home page Giter Site logo

Comments (3)

tomhamming avatar tomhamming commented on August 16, 2024

Has anyone done this successfully? I think the delegate is supposed to set the rect and view, but it's not clear to me how to determine that. In my case, I want it to keep pointing at the same view onscreen after rotation.

from wypopovercontroller.

tomhamming avatar tomhamming commented on August 16, 2024

Got it. If the popover is presented from a bar button, it just uses the bounds and the bar button's view as its rect and view. If you're presenting a popover pointing at a view, you probably did:

[popover presentPopoverFromRect:view.frame inView:view.superview permittedArrowDirections:dir  animated:YES];

Instead do this:

[popover presentPopoverFromRect:view.bounds inView:view permittedArrowDirections:dir animated:YES];

Remember the view you presented from, and give the delegate method the view's bounds and the view. I've got a singleton class that I use to coordinate popovers (dismiss the active one, etc), and I have a shortcut method on that class that looks like this:

-(WYPopoverController *)presentPopoverFromView:(UIView *)view withContent:(UIViewController *)content;

The singleton keeps track of the view it was given and handles the rotation.

from wypopovercontroller.

tomhamming avatar tomhamming commented on August 16, 2024

It would be cool if the popover had a presentPopoverFromView method that handled rotation automatically the same way it does for the bar button item...

from wypopovercontroller.

Related Issues (20)

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.