I want to disable the URL and NOTES fields of EKEventEditViewController

岁酱吖の 提交于 2019-12-21 06:58:14

问题


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.


回答1:


In header file include <UINavigationControllerDelegate> delegate

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;


来源:https://stackoverflow.com/questions/17469433/i-want-to-disable-the-url-and-notes-fields-of-ekeventeditviewcontroller

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!