1
如果我開發一個應用程序,通過它我們可以選擇一個日期和時間,並輸入文本,並應該爲本地手機日曆的相應日期和時間添加文本。是否有任何方法可以實現這一目標。請幫助我out.Thanks。從iPhone中的應用程序添加數據到原生iPhone應用程序?
如果我開發一個應用程序,通過它我們可以選擇一個日期和時間,並輸入文本,並應該爲本地手機日曆的相應日期和時間添加文本。是否有任何方法可以實現這一目標。請幫助我out.Thanks。從iPhone中的應用程序添加數據到原生iPhone應用程序?
是的,應該可以使用EventKit框架(在iOS 4.0中引入)。 EKEvent
是您可能正在尋找的課程。
我使用此代碼
EKEventStore *eventStore = [[EKEventStore alloc] init];
if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)])
{
// the selector is available, so we must be on iOS 6 or newer
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (error)
{
// display error message here
}
else if (!granted)
{
// display access denied error message here
}
else
{
// access granted
// ***** do the important stuff here *****
}
});
}];
}
else
{
// this code runs in iOS 4 or iOS 5
// ***** do the important stuff here *****
}
主題是unhelfpul。 – 2010-08-06 19:18:15
[以編程方式在iPhone日曆中添加自定義事件]的可能重複(http://stackoverflow.com/questions/246249/programmatically-add-custom-event-in-the-iphone-calendar) – 2010-08-06 22:57:48