在我的应用中,我正在使用MBCalendar工具包

我从MBCalendar from CocoaControl获得了源代码。

但是,如何添加一个新事件以在tableview中显示呢?

最佳答案

 -(void)addEvents:(NSArray *)eventsArray forDate:(NSDate*)date
{
NSMutableArray *myeventsArray = [[NSMutableArray alloc] init];

NSMutableDictionary *eventsDict = [[NSMutableDictionary alloc] init];

for (int i =0; i< eventsArray.count ;i++)
{

    // Create events
    eventsDict = eventsArray[i];
    CKCalendarEvent* aCKCalendarEvent = [[CKCalendarEvent alloc] init];
    aCKCalendarEvent.title = [eventsDict  objectForKey:@"email"];
    aCKCalendarEvent.date = date; //[eventsArray  objectForKey:@"phone"];
    aCKCalendarEvent.address = [eventsDict  objectForKey:@"addrLine1"];
    aCKCalendarEvent.image = [eventsDict objectForKey:@"pPic"];
    aCKCalendarEvent.name = [eventsDict objectForKey:@"fname"];
    aCKCalendarEvent.appDate = [eventsDict objectForKey:@"apntDt"];
    aCKCalendarEvent.notes = [eventsDict objectForKey:@"notes"];
    aCKCalendarEvent.phone = [eventsDict objectForKey:@"phone"];
    [myeventsArray addObject: aCKCalendarEvent];
}

     [_data setObject:myeventsArray forKey:date];
     NSLog(@"data %@",_data);


}


您可以像这样添加事件

关于ios - 在iOS中为MBCalendar套件添加事件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17017681/

10-10 20:50