runway20 / PopoverView

A simple UIView popover control for iPhone/iPad written in CoreGraphics.
1.02k stars 213 forks source link

Method of getting topView fails when using with DCIntrospect - popover doesn't appear #26

Open jai opened 11 years ago

jai commented 11 years ago

The line below (to get the topView) returns the DCIntrospect window instead of the application's window. I realize that DCIntrospect is kind of a unique-purpose tool and the conflict won't arise in production because DCIntrospect should never be used in production, but just wanted to give people a heads up in case they had issues with the Popover not showing. No error is thrown, just found it by tracing through the code.

  // get the top view
// http://stackoverflow.com/questions/3843411/getting-reference-to-the-top-most-view-window-in-ios-application/8045804#8045804
 topView = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject];
ocrickard commented 11 years ago

Hey, yeah, this is actually the second or third time this has come up. We have struggled to find different ways to fix it, and the only good one that I came up with was adding a totally new window. I have a different branch on my local machine that has that code, though according to one of our peers here (sorry, it would take me awhile to find who) said it has problems with rotation. I'll try to push the branch to github today so you can take a look.

ocrickard commented 11 years ago

Looks like I already pushed it: https://github.com/runway20/PopoverView/tree/New-Window

Let me know if this works for you. If it does, maybe I can spend some time in the next couple weeks configuring the rotation support properly.

jai commented 11 years ago

Sure will check it out. Thanks for the great work by the way! I also semi-hacked a version of the PopoverView into a full-width popover. It 'kinda' supports rotation (dismisses when rotated but you can re-show it in landscape and it will resize to fit screen). It's really dirty but you can check it out in our beta app, in the photo gallery page (the comments popup): http://i.zodiobeta.com - currently a lot of the resizing happens outside the PopoverView class so I can't push it up yet, still trying to clean it up.

ocrickard commented 11 years ago

Nice, I'll check that out! I certainly didn't write the component with rotation in mind (the app I've spent the last year on is iPhone portrait only), so it's a real challenge to get it working right.

jai commented 11 years ago

Yeah I just need to find a way to make it dynamically redraw instead of forcibly resizing it from the outside. Also supporting keyboard appearing/disappearing at the same time isn't fun. Any comments on the app are appreciated, and thanks again!

ocrickard commented 11 years ago

Interesting. I'll leave comments through your feedback system so it's not here on GitHub. If you get a clean branch ready, we can talk about merging changes.