Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS-如何将事件添加到目标C中的kal库?_Ios_Objective C_Xcode_Calendar_Kal - Fatal编程技术网

iOS-如何将事件添加到目标C中的kal库?

iOS-如何将事件添加到目标C中的kal库?,ios,objective-c,xcode,calendar,kal,Ios,Objective C,Xcode,Calendar,Kal,我在项目中工作需要日历视图和事件,我尝试了许多库,但最后我决定使用它,因为它有能力添加事件 日历.h #import "Kal.h" #import "NSDate+Convenience.h" #import "EventKitDataSource.h" @interface Calendar : UIViewController<WebService_Delegate , UITableViewDelegate > { KalViewController *kal

我在项目中工作需要日历视图和事件,我尝试了许多库,但最后我决定使用它,因为它有能力添加事件

日历.h

#import "Kal.h"
#import "NSDate+Convenience.h"
#import "EventKitDataSource.h"


@interface Calendar : UIViewController<WebService_Delegate , UITableViewDelegate >
{


    KalViewController *kal;
    id dataSource;
}
如何将数据传递到数据源以显示它

这是它的样子

我需要设置事件列表到我的事件列表,我得到了重复的事件,它从我的日历读取


谢谢

您需要在对象中实现KalDataSource协议,并将该对象设置为您的kal对象的数据源。协议可以在这里找到

将KalDataSource协议添加到头文件中

在日历对象集的init方法中 kal.datasource=self

在对象中实现KalDataSource方法

- (void)viewDidLoad
{
    [super viewDidLoad];



    self.title = @"Caledar";
    kal = [[KalViewController alloc]initWithSelectionMode:KalSelectionModeSingle];
    kal.selectedDate = [NSDate dateStartOfDay:[NSDate date]];
     kal.delegate = self;


    kal.view.frame = CGRectMake(0, 65, kal.view.frame.size.width, kal.view.frame.size.height);

    [kal showAndSelectDate:[NSDate date]];
    //navController = [[UINavigationController alloc]initWithRootViewController:kal];
   // [self.view addSubview:navController.view];
    [self initVariable];
    [self getEvents];


    dataSource = [[EventKitDataSource alloc] init];
    kal.dataSource = dataSource;



   [self.view addSubview:kal.view];

}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    // Display a details screen for the selected event/row.
    EKEventViewController *vc = [[EKEventViewController alloc] init];

    vc.event = [dataSource eventAtIndexPath:indexPath];

    //[vc setEvent:[events_array objectAtIndex:indexPath.row]];
    vc.allowsEditing = NO;
    [navController pushViewController:vc animated:YES];
}