如何自定义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答案中找到了这个答案,并在我的项目中实现了它。 我忘了链接。 希望这有助于,并感谢我得到这个原始答案。

链接地址: http://www.djcxy.com/p/69151.html

上一篇: How to customise EKEventEditViewController

下一篇: How to stop execution of function in Clojure without exiting REPL?