Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/122.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios ';警告:当演示正在进行时,尝试在UINavigationController:0x7d090c00上演示^';关于使用UIPopoverPresentationController_Ios_Objective C - Fatal编程技术网

Ios ';警告:当演示正在进行时,尝试在UINavigationController:0x7d090c00上演示^';关于使用UIPopoverPresentationController

Ios ';警告:当演示正在进行时,尝试在UINavigationController:0x7d090c00上演示^';关于使用UIPopoverPresentationController,ios,objective-c,Ios,Objective C,我收到这样的警告:“警告:当演示正在进行时,尝试在UINavigationController:0x7d090c00上演示KKContactTypeTableViewController:0x7b6f2170!”在使用UIPopoverPresentationController时。就像在viewController A中推送UIPopoverPresentationController时所做的那样: -(void)contactTypePopView{ _contactTyp

我收到这样的警告:“警告:当演示正在进行时,尝试在UINavigationController:0x7d090c00上演示KKContactTypeTableViewController:0x7b6f2170!”在使用UIPopoverPresentationController时。就像在viewController A中推送UIPopoverPresentationController时所做的那样:

 -(void)contactTypePopView{
        _contactTypePopController = [[KKContactTypeTableViewController alloc] init];
        _contactTypePopController.modalPresentationStyle = UIModalPresentationPopover;
        //[self presentViewController:_contactTypePopController animated:YES completion:nil];
        [self.view.window.rootViewController presentViewController:_contactTypePopController animated:YES completion:nil];
        UIPopoverPresentationController *popPresent = [_contactTypePopController popoverPresentationController];
        popPresent.delegate = self;
        popPresent.permittedArrowDirections = UIPopoverArrowDirectionLeft;
        popPresent.sourceView = self.contaxt_type;
        popPresent.sourceRect = self.contaxt_type.bounds;


    }
并按如下方式关闭KKContactTypeTableViewController上的viewController:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    KKContactTpye *contactType = self.contactTypes[indexPath.row];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"ContactType" object:nil userInfo:@{@"ContactTypeName":contactType.Name,@"ContactTypeId":contactType.ID}];
    [self dismissViewControllerAnimated:YES completion:nil];
}

然后我将viewController A推到B,警告出现了,同时viewController A上的UIPopoverPresentationController也出现了!我在网上搜索并阅读了有关此的问题,但没有得到任何答案。请提前给出更好的解决方案,谢谢

尝试[self.view.window.rootViewController.presentingViewController presentViewController:\u contactTypePopController动画:是完成:无];此外,我不建议在演示时获取rootViewController。相反,如果控制器具有UINavigationController,则可以像[self.navigationController.presentingViewController presentViewController:\u contactTypePopController animated:YES completion:nil]那样显示@Varun我按照你说的做了,但它现在无法按我的方式推送UIPopoverPresentationController,然后我尝试[self.navigationController presentViewController:_ContactTypePopControllerAnimated:YES completion:nil];没关系,谢谢!