in iOS8: UIPopoverController presentPopoverFromRect not work for keyWindow any more

后端 未结 4 1535
臣服心动
臣服心动 2021-02-05 12:03

As titled, in iOS8, [UIPopoverController presentPopoverFromRect] does not work for [UIApplication sharedApplication].keyWindow any more. (It does work in iOS7)

I verifi

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-05 12:33

    I think you have to display it in full view/viewcontroller and not in [UIApplication sharedApplication].keyWindow

    So change this code:

    [testPopoverController presentPopoverFromRect:rect inView:[UIApplication sharedApplication].keyWindow permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
    

    to:

    [testPopoverController presentPopoverFromRect:rect inView:aViewControllerInYourApp permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
    

提交回复
热议问题