EKEventview控制器未显示导航栏

时间:2013-08-31 06:19:58

标签: ios objective-c

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

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];

1 个答案:

答案 0 :(得分:2)

使用Present viewcontroller你需要为UIViewcontroller添加sepreated 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];
    }