我想自定义EKEventEditViewController,使其URL和NOTES字段禁用或删除它。作为EKEventEditViewController的默认接口。我无法自己定制,我搜索了很多,并没有找到任何可行的解决方案。任何人都使用过这样的场景。请详细说明问题。
答案 0 :(得分:7)
在标题文件中包含< UINavigationControllerDelegate
>代表
将EKEventEditViewController
委托设置为self或YourCurrentView Controller,并编写UINavigationController委托方法,如下所示。
-(void)performCalendarActivity
{
NSLog(@"perform calendar activity called ");
EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil];
addController.eventStore = eventStore;
addController.delegate=self; //<---------------------------------- Must
EKEvent *event=[EKEvent eventWithEventStore:eventStore];
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
addController.event=event;
[self presentViewController:addController animated:YES completion:nil];
addController.editViewDelegate = self;
}
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if ([viewController isKindOfClass:[UITableViewController class]]) {
UITableView *tblView=((UITableViewController*)viewController).tableView;
tblView.backgroundColor=[UIColor redColor];
//Here you got the tableView now you can change everthing related to tableView.................
UITableViewCell *cell=[tblView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:5]];
cell.userInteractionEnabled=false;
UITableViewCell *cell2=[tblView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:4]];
cell2.userInteractionEnabled=false;
}
}
如果您不想显示它们,只需使用
cell.hidden=YES;
cell2.hidden=YES;