我有一个关于EKEventEditViewController的奇怪问题,它不会在导航栏中显示“添加事件”标题。我使用以下代码来表示它:
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
if (!granted) { return; }
__block EKEvent *calEvent = [EKEvent eventWithEventStore:eventStore];
calEvent.title = self.event.title;
calEvent.startDate = startDate;
calEvent.endDate = endDate;
calEvent.location = self.event.address.title;
[calEvent setCalendar:[eventStore defaultCalendarForNewEvents]];
__block EKEventEditViewController *eventViewController = [[EKEventEditViewController alloc] init];
eventViewController.editViewDelegate = self;
eventViewController.eventStore = eventStore;
eventViewController.event = calEvent;
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:eventViewController animated:YES completion:nil];
});
}];
结果如下:
非常感谢任何帮助。
答案 0 :(得分:0)
我不知道为什么会发生这种情况,但是当我在AppDelegate中添加以下外观设置时它自行修复:
NSDictionary *barTitleAppearanceDict = @{UITextAttributeFont : [UIFont fontWithName:@"HelveticaNeue" size:22.0]};
[[UINavigationBar appearance] setTitleTextAttributes:barTitleAppearanceDict];