警告! UIStoryboardPopoverSegue"已弃用"在目标c中,当我打开upopovercontroller>。,,

时间:2017-07-03 11:36:28

标签: ios objective-c xcode uipopover

我想通过准备segue方法打开UIPopoverPresentationController我尝试了以下代码,但它显示了一些警告错误消息,如" UIStoryboardPopoverSegue已弃用:首先在iOS 9.0中弃用" - 从您的访问destinationviewcontroller.popoverpresentation segue执行选择器或覆盖执行....

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    UIStoryboardPopoverSegue* popover = (UIStoryboardPopoverSegue*)segue;
    CGFloat horizontalInset = (self.frame.size.width - popover.popoverController.popoverContentSize.width) / (CGFloat)2.0;
    CGFloat verticalInset = (self.frame.size.height - popover.popoverController.popoverContentSize.width) / (CGFloat)2.0;

    popover.popoverController.popoverLayoutMargins =
    UIEdgeInsetsMake(
                     verticalInset,
                     horizontalInset,
                     verticalInset,
                     horizontalInset);
}}

0 个答案:

没有答案