3

今天是个好日子。

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

    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 写了这个

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

如何解决?

4

2 回答 2

1

presentModalViewController:animated:中已弃用iOS 6.0。改为使用presentViewController:animated:completion:

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

苹果文档

于 2013-09-23T10:29:51.880 回答
-1
 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];
于 2014-02-07T08:21:57.710 回答