Ios 以模态方式呈现一个EKCalendarChooser

Ios 以模态方式呈现一个EKCalendarChooser,ios,Ios,我正在尝试在我的应用程序中将新的EKCalendarChooser显示为模式视图。我正在使用以下代码执行此操作: EKCalendarChooser *calendarChooser = [[EKCalendarChooser alloc] initWithSelectionStyle:EKCalendarChooserSelectionStyleMultiple displayStyle:EKCalendarChooserDisplayAllCalendars

我正在尝试在我的应用程序中将新的EKCalendarChooser显示为模式视图。我正在使用以下代码执行此操作:

EKCalendarChooser *calendarChooser = [[EKCalendarChooser alloc] 
    initWithSelectionStyle:EKCalendarChooserSelectionStyleMultiple 
     displayStyle:EKCalendarChooserDisplayAllCalendars
     eventStore:self.ekDataSource.eventStore];


calendarChooser.showsDoneButton = YES;
calendarChooser.showsCancelButton = NO;
calendarChooser.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
calendarChooser.delegate = self;

[[self navigationController] presentViewController:calendarChooser animated:YES completion:nil];
[[self navigationController] pushViewController:calendarChooser animated:YES];
我遇到的问题是,当视图显示时,它缺少“完成”按钮。但是,如果使用以下代码显示视图:

EKCalendarChooser *calendarChooser = [[EKCalendarChooser alloc] 
    initWithSelectionStyle:EKCalendarChooserSelectionStyleMultiple 
     displayStyle:EKCalendarChooserDisplayAllCalendars
     eventStore:self.ekDataSource.eventStore];


calendarChooser.showsDoneButton = YES;
calendarChooser.showsCancelButton = NO;
calendarChooser.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
calendarChooser.delegate = self;

[[self navigationController] presentViewController:calendarChooser animated:YES completion:nil];
[[self navigationController] pushViewController:calendarChooser animated:YES];
它很好用。此时将显示“完成”按钮。“完成”按钮不应该与presentViewController调用一起显示吗

提前感谢您的帮助


pmb

如果当前视图控制器位于导航控制器内,则应继续使用该导航控制器,除非您确实需要更多屏幕空间。然后,您应该使用动画以模态方式呈现新的视图控制器,该视图控制器告诉用户他们正在离开导航控制器的上下文


[self.navigationController pushViewControllerAnimated:how]

使用EKClaenderChooserDelegate方法。使用此方法,我解决了我的问题

  • (void)calendarChooserDidFinish:(EKCalendarChooser*)calendarChooser

    { [self.navigationController-popToRootViewControllerAnimated:是]

    }