问题描述
我想自定义EKEventEditViewController,使其URL和NOTES字段禁用或删除它。作为EKEventEditViewController的默认接口。我无法自己定制,我搜索了很多,并没有找到任何可行的解决方案。任何人都使用过这样的场景。请详细说明问题。
I want to customize the EKEventEditViewController with making its URL and NOTES fields disable or removing it. As its the default interface of EKEventEditViewController. I am not able to customize it on myself, I googled a lot for that and can not found any of the feasible solution for this. Any one have worked with such a scenario.Please elaborate the issue.
推荐答案
在头文件中包含< UINavigationControllerDelegate
> delegate
In header file include <UINavigationControllerDelegate
> delegate
设置 EKEventEditViewController
委托给self或YourCurrentView Controller并编写UINavigationController委托方法,如下所示。
Set EKEventEditViewController
delegate to self or YourCurrentView Controller and write UINavigationController delegate method as given below.
-(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;
}
}
如果你不想显示它们只需使用
If you do not want to show them simply use
cell.hidden=YES;
cell2.hidden=YES;
这篇关于我想禁用EKEventEditViewController的URL和NOTES字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!