2016-06-13 2 views
-19

Я хочу получить доступ к Родительскому календарю в своем приложении. В нем упоминается так много ссылок, но до сих пор не удалось выполнить этот процесс. События отображаются в моем календаре. Установка оповещения о времени и дате также используется пользователем. Любое решение для меня очень ценилось.EKCalendar на моем приложении ipad

+0

Что вы подразумеваете под «Родным календарем». Вы имеете в виду, что вам нужен календарь, который отображает месяцы и дни недели? –

+3

Ваше заявление о проблеме неясно. – JAL

+0

Используете ли вы быстрый или объективный 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]]; 

Так это работает точно.

Смежные вопросы