gpt4 book ai didi

iphone - 如何自定义 EKEventEditViewController?

转载 作者:行者123 更新时间:2023-12-03 21:04:03 29 4
gpt4 key购买 nike

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

我尝试像这样循环遍历它的 subview ,但没有成功。

失败的代码:

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];

最佳答案

您可以使用UINavigationController委托(delegate)方法来自定义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

关于iphone - 如何自定义 EKEventEditViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9264781/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com