ios 簡便的提醒管理類 可以當鬧鐘用

來源:互聯網
上載者:User

標籤:ios   鬧鐘   簡便   快捷   

github地址: https://github.com/li6185377/LKAlarmManager

方便快捷的把 “您的提醒” 加入到 日曆或者本地通知中 
會自動處理本地通知超過64個的情況

QQ群號 113767274 有什麼問題或者改進的地方大家一起討論

使用例子 1、 把下面三個 UIApplication回調, 傳給LKAlarmManager

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    [[LKAlarmMamager shareManager] didFinishLaunchingWithOptions:launchOptions];    return YES;}-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{    [[LKAlarmMamager shareManager] handleOpenURL:url];    return YES;}-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{    [[LKAlarmMamager shareManager] didReceiveLocalNotification:notification];}

2、加添提醒到 LKAlarmManager 中.

    LKAlarmEvent* event = [LKAlarmEvent new];    event.title = @"參試加入日曆事件中";    event.content = @"只有加入到日曆當中才有用,是日曆中的備忘";    ///工作日提醒    event.repeatType = LKAlarmRepeatTypeWork;    ///60秒後提醒我    event.startDate = [NSDate dateWithTimeIntervalSinceNow:60];    ///也可以強制加入到本地提醒中    //event.isNeedJoinLocalNotify = YES;    ///會先嘗試加入日曆  如果日曆沒許可權 會加入到本地提醒中    [[LKAlarmMamager shareManager] addAlarmEvent:event callback:^(LKAlarmEvent *alarmEvent) {        dispatch_async(dispatch_get_main_queue(), ^{            UILabel* label =     ((ViewController*)_window.rootViewController).lb_haha;            if(alarmEvent.isJoinedCalendar)            {                label.text = @"已加入日曆";            }            else if(alarmEvent.isJoinedLocalNotify)            {                label.text = @"已加入本地通知";            }            else            {                label.text = @"加入通知失敗";            }        });    }];

3、 註冊 LKAlarmManager 回調,接收到提醒的時候 做你想做的事

    ///regist delegate    [[LKAlarmMamager shareManager] registDelegateWithObject:self];-(void)lk_receiveAlarmEvent:(LKAlarmEvent *)event{    UIAlertView* alertView = [[UIAlertView alloc]initWithTitle:@"接受到通知!" message:event.title delegate:nil cancelButtonTitle:@"確定" otherButtonTitles:nil];    [alertView show];}

ios 簡便的提醒管理類 可以當鬧鐘用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.