繁体   English   中英

在表视图中呈现模态视图控制器

[英]Presenting modal view controller in Table View

今天是个好日子。

我在表视图控制器中有这个代码:

    else if (editingStyle == UITableViewCellEditingStyleInsert) {


        if([[UIScreen mainScreen] bounds].size.height == 568)
        {
            citySearch = [[CitySearch alloc] initWithNibName:@"CitySearchIphone5" bundle:nil];

        }
        else
        {
            citySearch = [[CitySearch alloc] initWithNibName:@"CitySearch" bundle:nil];
        }
        UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:citySearch];
        [self presentModalViewController:navController animated:YES];

因此,当它呈现时,我看到视图,这是超越边界,Xcode写这个

不鼓励在分离的视图控制器上呈现视图控制器

怎么解决?

presentModalViewController:animated:iOS 6.0已弃用。 使用presentViewController:animated:completion:而不是。

[self presentViewController:navController animated:YES completion:nil];

Apple文档

 MACommentsViewController *obj_AboutVC;
 if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
 {
    if (IS_IPHONE_5)
    {
        obj_AboutVC = [[MACommentsViewController alloc]         initWithNibName:@"MACommentsViewController" bundle:nil];
    }
    else
    {
        obj_AboutVC = [[MACommentsViewController alloc] initWithNibName:@"MACommentsViewController_iPhone4" bundle:nil];
    }
}

[self presentViewController:obj_AboutVC animated:YES completion:nil];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM