Jac*_*cky 16 uipopovercontroller ios8
正如标题所述,在iOS8中,[UIPopoverController presentPopoverFromRect]不再适用于[UIApplication sharedApplication] .keyWindow.(它在iOS7中有效)
我验证了以下代码:
TestViewController *test = [[TestViewController alloc] initWithNibName:nil bundle:nil];
if (testPopoverController == nil) {
    testPopoverController = [[UIPopoverController alloc] initWithContentViewController:test];
    testPopoverController.popoverContentSize = CGSizeMake(250, 95*5);
}
CGPoint point = [sender convertPoint:CGPointMake(0, 0) toView:nil];
CGRect rect = CGRectMake(point.x, point.y, 24, 24);
[testPopoverController presentPopoverFromRect:rect inView:[UIApplication sharedApplication].keyWindow permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
C0D*_*0D3 -1
我认为你必须在完整视图/视图控制器中显示它,而不是在 [UIApplication sharedApplication].keyWindow 中显示它
所以修改这段代码:
[testPopoverController presentPopoverFromRect:rect inView:[UIApplication sharedApplication].keyWindow permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
到:
[testPopoverController presentPopoverFromRect:rect inView:aViewControllerInYourApp permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
| 归档时间: | 
 | 
| 查看次数: | 8280 次 | 
| 最近记录: |