2016-06-13 3 views
-19

私のアプリケーションのネイティブカレンダーにアクセスしたいです。これは多くのリンクを参照していますが、まだそのプロセスを実行できませんでした。イベントは私のカレンダーに表示されます。時間と日付を設定すると、ユーザーにも警告が表示されます。私のための任意のソリューションは非常に感謝します。私のipadアプリケーションのEKCalendar

+0

「ネイティブカレンダー」とはどういう意味ですか?月や曜日を表示するカレンダービューが必要なことを意味しますか? –

+3

問題のステートメントが不明です。 – JAL

+0

あなたはswiftまたはobjective-cを使用していますか? –

答えて

1

最後に、私はこれに対する解決策を見つけました。

....> appdelegate


(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification 
{ 

UIApplicationState state = [application applicationState]; 
if (state == UIApplicationStateActive) { 
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Reminder" 
                message:notification.alertBody 
                delegate:self cancelButtonTitle:@"OK" 
              otherButtonTitles:nil]; 
    [alert show]; 

} 

// Request to reload table view data 
[[NSNotificationCenter defaultCenter] postNotificationName:@"Notification" object:self]; 


} 

で....>リマインダー-SecondClass(保存アクション)を作成

UILocalNotification* localNotification = [[UILocalNotification alloc] init]; 

    localNotification.fireDate = pickerDate; 

    localNotification.alertBody = self.EventText.text; 

    localNotification.soundName=UILocalNotificationDefaultSoundName; 

    localNotification.alertAction = @"Show me the item"; 

    localNotification.timeZone = [NSTimeZone defaultTimeZone]; 

    localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] +1; 

    NSUserDefaults *Defaults=[NSUserDefaults standardUserDefaults]; 

    [Defaults setObject:dateString forKey:@"eventdate"]; 
    NSLog(@"Datepicker Date..%@",dateString); 

    [Defaults synchronize]; 

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 

    // Request to reload table view data 
    [[NSNotificationCenter defaultCenter] postNotificationName:@"Notification" object:self]; 

    // Dismiss the view controller 
    [self.navigationController popViewControllerAnimated:YES]; 

//ファーストクラス

- →viewDidLoad

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(reloadTable) 
              name:@"Notification" 
              object:nil]; 

cellForRowAtIndexPath

UILocalNotification *localNotification = [AlarmArray objectAtIndex:indexPath.row]; 

// Display notification info 
[cell.EventText setText:localNotification.alertBody]; 

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; 

[dateFormat setDateFormat: @"dd-MM-yyyy"]; 

DateString=[dateFormat stringFromDate:localNotification.fireDate]; 

[dateFormat setDateFormat:@"h:mm a"]; 

NSString *TimeString=[dateFormat stringFromDate:localNotification.fireDate]; 

[cell.TimeLabel setText:[TimeString description]]; 

NSLog(@"Datepicker Date..%@",DateString); 

[cell.EventDate setText:[DateString description]]; 

だから、細かく動作します。

関連する問題