我使用以下代码查看事件。但是导航栏不可见。

EKEventViewController *addController = [[EKEventViewController alloc] initWithNibName:nil bundle:nil];
addController.event = self.event;
addController.allowsEditing = YES;
addController.allowsCalendarPreview = YES;
[self.navigationController presentViewController:addController animated:YES completion:nil];

最佳答案

使用Present viewcontroller,您需要为UIViewcontroller添加分离的NavigationController,例如:

EKEventViewController *addController = [[EKEventViewController alloc] initWithNibName:@"EKEventViewController" bundle:nil];
UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:addController];
addController.event = self.event;
addController.allowsEditing = YES;
addController.allowsCalendarPreview = YES;


if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
    {
           [self presentViewController:navController animated:YES completion:nil];
    }
    else
    {

        [self presentModalViewController:navController animated:YES];
    }

08-04 23:36