1

我想自定义 EKEventEditViewController,使其 URL 和 NOTES 字段禁用或删除它。作为 EKEventEditViewController 的默认接口。我无法自己定制它,为此我搜索了很多,但找不到任何可行的解决方案。任何人都处理过这种情况。请详细说明这个问题。

4

1 回答 1

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;
于 2013-07-04T11:46:59.887 回答