iOS日曆中怎樣給一個事件添加多個提醒

來源:互聯網
上載者:User

iOS日曆中怎樣給一個事件添加多個提醒

iOS內建的日曆應用中,我們最多隻能給一個事件設定2個提醒,但是通過代碼,我們可以給事件設定任意多個提醒.

給事件設定提醒的代碼可以看我寫的這篇文章:

iOS9中怎樣在日曆App中建立一個任意時間之前開始的提醒(三)

設定多個提醒的方法與此類似,我們只要建立多個提醒,再添加它們到事件中就可以了:

EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:-7.f];    event.title = @"Event with Alarm";    [event addAlarm:alarm];    EKAlarm *alarm2 = [EKAlarm alarmWithRelativeOffset:-17.f];    [event addAlarm:alarm2];    EKAlarm *alarm3 = [EKAlarm alarmWithRelativeOffset:-27.5f];    [event addAlarm:alarm3];

不過這樣設定了提醒後,我們開啟iOS系統內建的日曆App,會發現只會顯示2個提醒,看不到多餘的提醒.但是實際測試發現全部提醒都可以工作,而且我們可以在Mac的行事曆程式中看到所有的提醒:

  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.