UIPopOver management and USE_BLOCK_IN_FRAME error
-
18-06-2021 - |
Question
I've recently upgraded to iOS 6 Beta and am having some issues. (I know it's a beta, but I'm not yet convinced that it's actually iOS 6-related.)
The issue has the following parameters:
- Custom
UITableViewCell
withUIButton
objects that generateUIPopOver
objects, presented from the frame of theUIButton
that was tapped. - The
UIPopOver
is displayed and then the iPad is rotated. - My view dismisses the
UIPopOver
when the rotation animation completes and then re-displays theUIPopOver
.
Relevant Information:
- The first rotation proceeds fine; the
UIPopOver
is dismissed and re-displayed correctly. - The second rotation (EVERY TIME) is what breaks the app.
- I have a symbolic breakpoint set, but I'm not getting any useful information.
- I'm doing the same thing with
UIPopOver
objects presented fromUIBarButton
objects in aUIToolbar
. I experience no problems with those transitions. - This is a new problem that is related to code that hasn't changed in a good while.
- The error I receive is: "warning: Attempting to create USE_BLOCK_IN_FRAME variable with block that isn't in the frame."
Here's the code that executes related to the rotation:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
if ([self PopOver]) {
[[self PopOver] dismissPopoverAnimated:YES];
[self setPopOver:nil];
[self ButtonPressed:[self TouchedCell]];
}
[[self TableView1] reloadData];
[[self TableView2] reloadData];
}
- (void)ButtonPressed:(Cell *)cell {
[self setTouchedCell:cell];
NSString *nibName = @"View";
if (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) {
nibName = @"View-iPad";
}
ViewController *vc = [[ViewController alloc] initWithNibName:nibName
bundle:nil];
if (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) {
UIPopoverController *popOver = [[UIPopoverController alloc]
initWithContentViewController:vc];
[self setPopOver:popOver];
[popOver setDelegate:self];
[[self PopOver] setPopoverContentSize:CGSizeMake(320, 320)];
[popOver presentPopoverFromRect:[[cell CheckButton] frame]
inView:[cell contentView]
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
} else {
// iPhone doesn't use PopOvers...
}
}
Anyone know what I should do next?
Solution
Here's my official answer - I think your popover is trying to display offscreen, or maybe from an already recycled cell. ;)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow