如何自定义EKEventEditViewController

我在我的应用程序中使用默认的EKEventEditViewController ,我想定制它,目前它显示默认EKEventEditViewController所有字段,但我不想显示URL字段,也想添加时区字段。 我可以这样做,如果是的话,请让我知道我该怎么做? 在这里输入图像说明

你可以使用这个摘录:

1)使您的viewcontroller您的EKEventEditViewController的委托

 EKEventEditViewController *addController = [[EKEventEditViewController alloc] init]; addController.delegate = self; 

2)然后在你的视图控制器上实现这个:

 - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { if ([viewController isKindOfClass:[UITableViewController class]]) { UITableView *tableView = ((UITableViewController *)viewController).tableView; for (NSInteger j = 0; j < [tableView numberOfSections]; ++j) { for (NSInteger i = 0; i < [tableView numberOfRowsInSection:j]; ++i) { UITableViewCell *cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:j]]; NSLog(@"cell => %@, row => %d, section => %d", cell.textLabel.text, i, j); if([cell.textLabel.text isEqualToString:@"Calendar"]) { [cell removeFromSuperview]; } else if(j == 5) { // If URL Field [cell removeFromSuperview]; } } } } 

}

注意:我发现在另一个Stackoverflow答案之前,并在我的项目上实现它。 我忘了链接。 希望这有助于和感谢原来的答案,我得到了这个。