你可以使用这段摘录:
1)使您的视图控制器成为 EKEventEditViewController 的委托
EKEventEditViewController *addController = [[EKEventEditViewController alloc] init];
addController.delegate = self;
Run Code Online (Sandbox Code Playgroud)
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];
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
}
注意:我之前在另一个 Stackoverflow 答案中发现了这一点,并在我的项目中实现了它。我忘记了链接。希望这会有所帮助,并感谢我得到这个的原始答案。
| 归档时间: |
|
| 查看次数: |
2627 次 |
| 最近记录: |