2

我正在使用 EKEventEditViewController 向日历添加事件,但是我需要自定义表格视图,例如背景颜色和单元格属性。

我试过像这样循环遍历它的子视图,但没有运气。

失败的代码:

EKEventEditViewController *eventVc = [[EKEventEditViewController alloc] init];
    eventVc.event = event;
    eventVc.delegate = self;
    eventVc.eventStore = eventStore;
    eventVc.editViewDelegate = self;

    for (UITableView *view in [eventVc.view subviews]) {
        [view setBackgroundColor:[UIColor redColor]];
    }

    [self presentModalViewController:eventVc animated:YES];
4

2 回答 2

2

您可以使用UINavigationController委托方法来自定义EKEventEditViewController.

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if ([viewController isKindOfClass:[UITableViewController class]]) {

        UITableView *tblView=((UITableViewController*)viewController).tableView;

        [tblView setBackgroundColor:[UIColor redColor]];
        [tblView setBackgroundView:nil];
    }
}

看看这个https://stackoverflow.com/a/17469491/1305001

于 2013-07-04T11:52:27.907 回答
0

对此没有简单的解决方案,但我最终创建了一个自定义视图控制器,我从中手动处理所有事件数据。

于 2012-04-18T09:35:17.017 回答