本文介绍了在iOS中为MBCalendar套件添加事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用中,我正在使用 MBCalendar Kit
In my app, i am using the MBCalendar Kit
我从CocoaControl的 MBCalendar获得了源代码.
I got the source code from MBCalendar from CocoaControl.
但是如何添加一个新事件以在表视图中显示?
But how can I add a new event for displaying in the 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中为MBCalendar套件添加事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!