I've got an iPad app with a “drawer” table displayed in a popover. The user can tap-and-hold on an item in the drawer to drag that item out of it and into my main view. That part works fine; unfortunately, the view being dragged appears under the popover, and is too small to be visible until it's dragged out from underneath it. If I add the view as a subview of the view controller in the popover, it gets clipped by the popover's frame, and as I can't access the UIPopoverController
's view, I can't disable its layer's masksToBounds
—and that probably wouldn't be a great idea anyway. I suspect that I could use an additional UIWindow
with a high windowLevel
value to force the dragged view to appear on top of the popover, but this seems like overkill. Is there a better solution?
views:
366answers:
1
+2
A:
Got it. UIWindow
works fine. Code:
// when drag starts
draggingView = [[UIWindow alloc] initWithFrame:CGRectMake(0,0,100,100)];
draggingView.windowLevel = UIWindowLevelAlert;
draggingView.center = [gestureRecognizer locationInView:self.view.window];
[draggingView makeKeyAndVisible];
// when drag ends
[draggingView release];
draggingView = nil;
Noah Witherspoon
2010-04-12 14:16:33