How to decide whether the default EKCalendar 'Calendar' can be hidden?

ⅰ亾dé卋堺 提交于 2019-12-05 03:25:11

To answer your question in bold, there isn't a magic property you can use to determine if a calendar should be hidden or displayed.

However, if your theory is correct about the Calendar app hiding the "local" calendar if other calendar types are available (iCloud/MobileMe, Exchange, CalDAV, etc), then you can mirror its logic in your code using the EKSource array in EKEventStore

EKEventStore *store = [[EKEventStore alloc] init];

for (EKSource *source in store.sources)
    if (source.sourceType == EKSourceTypeExchange || source.sourceType == EKSourceTypeCalDAV)
    {
        //Your custom logic here to determine if the local cal should be hidden.
        break;
    }

You can find the full list of EKSourceType constants here: http://developer.apple.com/library/ios/#documentation/EventKit/Reference/EKSourceClassRef/Reference/Reference.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!