tailieunhanh - iOS 5 Programming Cookbook phần 9
Bằng cách phân bổ và khởi tạo một đối tượng của loại EKEventStore, bạn có thể truy cập các loại khác nhau của lịch có sẵn trên một thiết bị IOS. iOS hỗ trợ các định dạng lịch phổ biến như CalDAV và Exchange. Tài sản lịch của một thể hiện của | Calendar 2 Type Local Calendar 2 Color UIDeviceRGBColorSpace 1 Calendar 2 can be modified. Calendar 3 Title Calendar Calendar 3 Type CalDAV Calendar 3 Color UIDeviceRGBColorSpace 1 Calendar 3 can be modified. Calendar 4 Title Home Calendar 4 Type CalDAV Calendar 4 Color UIDeviceRGBColorSpace 1 Calendar 4 can be modified. Calendar 5 Title Work Calendar 5 Type CalDAV Calendar 5 Color UIDeviceRGBColorSpace 0 1 Calendar 5 can be modified. Calendar 6 Title Calendar 6 Type CalDAV Calendar 6 Color UIDeviceRGBColorSpace 1 Calendar 6 can be modified. Discussion By allocating and initializing an object of type EKEventStore you can access different types of calendars that are available on an iOS device. iOS supports common calendar formats such as CalDAV and Exchange. The calendars property of an instance of EKEventStore is of type NSArray and contains the array of calendars that are on an iOS device. Each object in this array is of type EKCalendar and each calendar has properties that allow us to determine whether for instance we can insert new events into that calendar. As we will see in Recipe a calendar object allows modifications only if its allowsContentModifications property has a YES value. You can use the colorWithCGColor instance method of UIColor to retrieve an object of type UIColor from CGColorRef. See Also Recipe Adding Events to Calendars Problem You would like to be able to create new events in users calendars. 696 Chapter 14 Dates Calendars and Events Solution Find the calendar you want to insert your event into please refer to Recipe . Create an object of type EKEvent using the eventWithEventStore class method of EKEvent and save the event into the user s calendar using the saveEvent span error instance method of EKEventStore - BOOL createEventWithTitle NSString paramTitle startDate NSDate .
đang nạp các trang xem trước