Event Kit u i Framework Ref

26
Event Kit UI Framework Reference User Experience 2010-09-22

Transcript of Event Kit u i Framework Ref

Page 1: Event Kit u i Framework Ref

Event Kit UI Framework ReferenceUser Experience

2010-09-22

Page 2: Event Kit u i Framework Ref

Apple Inc.© 2010 Apple Inc.All rights reserved.

No part of this publication may be reproduced,stored in a retrieval system, or transmitted, inany form or by any means, mechanical,electronic, photocopying, recording, orotherwise, without prior written permission ofApple Inc., with the following exceptions: Anyperson is hereby authorized to storedocumentation on a single computer forpersonal use only and to print copies ofdocumentation for personal use provided thatthe documentation contains Apple’s copyrightnotice.

The Apple logo is a trademark of Apple Inc.

No licenses, express or implied, are grantedwith respect to any of the technology describedin this document. Apple retains all intellectualproperty rights associated with the technologydescribed in this document. This document isintended to assist application developers todevelop applications only for Apple-labeledcomputers.

Apple Inc.1 Infinite LoopCupertino, CA 95014408-996-1010

Apple, the Apple logo, and Objective-C aretrademarks of Apple Inc., registered in theUnited States and other countries.

IOS is a trademark or registered trademark ofCisco in the U.S. and other countries and is usedunder license.

Even though Apple has reviewed this document,APPLE MAKES NO WARRANTY OR REPRESENTATION,EITHER EXPRESS OR IMPLIED, WITH RESPECT TOTHIS DOCUMENT, ITS QUALITY, ACCURACY,MERCHANTABILITY, OR FITNESS FOR A PARTICULARPURPOSE. AS A RESULT, THIS DOCUMENT ISPROVIDED “AS IS,” AND YOU, THE READER, AREASSUMING THE ENTIRE RISK AS TO ITS QUALITYAND ACCURACY.

IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT,INDIRECT, SPECIAL, INCIDENTAL, ORCONSEQUENTIAL DAMAGES RESULTING FROM ANYDEFECT OR INACCURACY IN THIS DOCUMENT, evenif advised of the possibility of such damages.

THE WARRANTY AND REMEDIES SET FORTH ABOVEARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORALOR WRITTEN, EXPRESS OR IMPLIED. No Appledealer, agent, or employee is authorized to makeany modification, extension, or addition to thiswarranty.

Some states do not allow the exclusion or limitationof implied warranties or liability for incidental orconsequential damages, so the above limitation orexclusion may not apply to you. This warranty gives

you specific legal rights, and you may also haveother rights which vary from state to state.

Page 3: Event Kit u i Framework Ref

Contents

Introduction Introduction 5

Part I Classes 7

Chapter 1 EKEventEditViewController Class Reference 9

Overview 9Tasks 9Properties 10

Chapter 2 EKEventViewController Class Reference 13

Overview 13Tasks 13Properties 14

Part II Protocols 17

Chapter 3 EKEventEditViewDelegate Protocol Reference 19

Overview 19Tasks 19Instance Methods 20Constants 21

Chapter 4 EKEventViewDelegate Protocol Reference 23

Overview 23Tasks 23Instance Methods 23Constants 24

Document Revision History 25

32010-09-22 | © 2010 Apple Inc. All Rights Reserved.

Page 4: Event Kit u i Framework Ref

42010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CONTENTS

Page 5: Event Kit u i Framework Ref

Framework /System/Library/Frameworks/EventKitUI.framework

Header file directories EventKitUI.framework/Headers

Declared in EKEventEditViewController.hEKEventViewController.h

The Event Kit UI framework provides the classes needed to create, edit, and display events using a viewcontroller. It provides several configurable view controller classes.

52010-09-22 | © 2010 Apple Inc. All Rights Reserved.

INTRODUCTION

Introduction

Page 6: Event Kit u i Framework Ref

62010-09-22 | © 2010 Apple Inc. All Rights Reserved.

INTRODUCTION

Introduction

Page 7: Event Kit u i Framework Ref

72010-09-22 | © 2010 Apple Inc. All Rights Reserved.

PART I

Classes

Page 8: Event Kit u i Framework Ref

82010-09-22 | © 2010 Apple Inc. All Rights Reserved.

PART I

Classes

Page 9: Event Kit u i Framework Ref

Inherits from UINavigationController : UIViewController : UIResponder : NSObject

Conforms to NSCoding (UIViewController)NSObject (NSObject)

Framework /System/Library/Frameworks/EventKitUI.framework

Availability Available in iOS 4.0 and later.

Declared in EKEventEditViewController.h

Companion guide Event Kit Programming Guide

Related sample code SimpleEKDemo

Overview

An EKEventEditViewController object allows the user to create and edit a calendar event. You can usethis class to create a new event or a partially constructed event. If the new event has no calendar, the defaultcalendar is used. You should present this type of view controller modally.

Tasks

Setting and Getting Properties

editViewDelegate (page 10) propertyThe delegate that is notified when editing is done.

event (page 10) propertyThe event the user creates or edits using this view controller.

eventStore (page 10) propertyThe event store used to save the event.

Overview 92010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 1

EKEventEditViewController Class Reference

Page 10: Event Kit u i Framework Ref

Properties

For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.

editViewDelegateThe delegate that is notified when editing is done.

@property(nonatomic, assign) id<EKEventEditViewDelegate> editViewDelegate

AvailabilityAvailable in iOS 4.0 and later.

Related Sample CodeSimpleEKDemo

Declared InEKEventEditViewController.h

eventThe event the user creates or edits using this view controller.

@property(nonatomic, retain) EKEvent *event

DiscussionIf nil, a new event is created and added to the specified event store. New events are added to the defaultcalendar. An exception is raised if set to an event that is not in the specified event store.

AvailabilityAvailable in iOS 4.0 and later.

See Also @property eventStore (page 10)

Related Sample CodeSimpleEKDemo

Declared InEKEventEditViewController.h

eventStoreThe event store used to save the event.

@property(nonatomic, retain) EKEventStore *eventStore

DiscussionThis property must be set before displaying the view.

10 Properties2010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 1

EKEventEditViewController Class Reference

Page 11: Event Kit u i Framework Ref

AvailabilityAvailable in iOS 4.0 and later.

See Also @property event (page 10)

Related Sample CodeSimpleEKDemo

Declared InEKEventEditViewController.h

Properties 112010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 1

EKEventEditViewController Class Reference

Page 12: Event Kit u i Framework Ref

12 Properties2010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 1

EKEventEditViewController Class Reference

Page 13: Event Kit u i Framework Ref

Inherits from UIViewController : UIResponder : NSObject

Conforms to NSCoding (UIViewController)NSObject (NSObject)

Framework /System/Library/Frameworks/EventKitUI.framework

Availability Available in iOS 4.0 and later.

Declared in EKEventViewController.h

Companion guide Event Kit Programming Guide

Related sample code SimpleEKDemo

Overview

An EKEventViewController object displays the details of a calendar event. You can set whether users areallowed to edit the event. If the event is an invitation, where the organizer is not the user, you can set whethera calendar preview is shown.

You need to assign a delegate to an EKEventViewController object to receive a notification when theview controller should be closed. The delegate must conform to the EKEventViewDelegate protocol.

Tasks

Getting and Setting the Event

event (page 15) propertyThe event this view controller displays to the user.

Overview 132010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 2

EKEventViewController Class Reference

Page 14: Event Kit u i Framework Ref

Enabling Features

allowsCalendarPreview (page 14) propertyA Boolean value that determines whether the user can view the event in a calendar day preview.

allowsEditing (page 14) propertyA Boolean value that determines whether the user is allowed to edit the event.

Acessing the Delegate

delegate (page 15) propertyThe event view controller’s delegate.

Properties

For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.

allowsCalendarPreviewA Boolean value that determines whether the user can view the event in a calendar day preview.

@property(nonatomic) BOOL allowsCalendarPreview

DiscussionIf the event is an invitation and this property is YES, then a table cell appears allowing the user to previewthe event along with other events on the same day. If NO (the default), the calendar day preview does notappear. This property applies only to invitations.

AvailabilityAvailable in iOS 4.0 and later.

Declared InEKEventViewController.h

allowsEditingA Boolean value that determines whether the user is allowed to edit the event.

@property(nonatomic) BOOL allowsEditing

DiscussionIf NO (the default), the event is not editable. If YES, the Edit button appears and the user is allowed to changeproperties of the event. This property applies only to events in an editable calendar that were created by theuser. For example, it doesn’t apply to invitations sent by another user.

14 Properties2010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 2

EKEventViewController Class Reference

Page 15: Event Kit u i Framework Ref

AvailabilityAvailable in iOS 4.0 and later.

Related Sample CodeSimpleEKDemo

Declared InEKEventViewController.h

delegateThe event view controller’s delegate.

@property(nonatomic, assign) id<EKEventViewDelegate> delegate

AvailabilityAvailable in iOS 4.2 and later.

Declared InEKEventViewController.h

eventThe event this view controller displays to the user.

@property(nonatomic, retain) EKEvent *event

DiscussionThis property must be set before the view is displayed.

AvailabilityAvailable in iOS 4.0 and later.

Related Sample CodeSimpleEKDemo

Declared InEKEventViewController.h

Properties 152010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 2

EKEventViewController Class Reference

Page 16: Event Kit u i Framework Ref

16 Properties2010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 2

EKEventViewController Class Reference

Page 17: Event Kit u i Framework Ref

172010-09-22 | © 2010 Apple Inc. All Rights Reserved.

PART II

Protocols

Page 18: Event Kit u i Framework Ref

182010-09-22 | © 2010 Apple Inc. All Rights Reserved.

PART II

Protocols

Page 19: Event Kit u i Framework Ref

Conforms to NSObject

Framework /System/Library/Frameworks/EventKitUI.framework

Availability Available in iOS 4.0 and later.

Declared in EKEventEditViewController.h

Companion guide Event Kit Programming Guide

Related sample code SimpleEKDemo

Overview

Delegates of an EKEventEditViewController object conform to this protocol. Use anEKEventEditViewController object to allow the user to either create an event or edit an existing event.To be notified when the user finishes editing the event, set the delegate to an object conforming to thisprotocol.

Tasks

Finishing an Edit

– eventEditViewController:didCompleteWithAction: (page 20)Invoked with the user is finished editing the event. (required)

Getting the Default Calendar

– eventEditViewControllerDefaultCalendarForNewEvents: (page 20)Returns the calendar to use as the default calendar for new events. (required)

Overview 192010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 3

EKEventEditViewDelegate Protocol Reference

Page 20: Event Kit u i Framework Ref

Instance Methods

eventEditViewController:didCompleteWithAction:Invoked with the user is finished editing the event. (required)

- (void)eventEditViewController:(EKEventEditViewController *)controllerdidCompleteWithAction:(EKEventEditViewAction)action

Parameterscontroller

The edit view controller presenting the event.

actionThe action the user took to end editing.

DiscussionYou must implement this method to dismiss the event edit view controller that was presented modally.

AvailabilityAvailable in iOS 4.0 and later.

Declared InEKEventEditViewController.h

eventEditViewControllerDefaultCalendarForNewEvents:Returns the calendar to use as the default calendar for new events. (required)

- (EKCalendar *)eventEditViewControllerDefaultCalendarForNewEvents:(EKEventEditViewController *)controller

Parameterscontroller

The event edit view controller requesting the default calendar.

DiscussionIf the delegate does not implement this method, the defaultCalendarForNewEvents property of theevent store is used.

AvailabilityAvailable in iOS 4.0 and later.

Declared InEKEventEditViewController.h

20 Instance Methods2010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 3

EKEventEditViewDelegate Protocol Reference

Page 21: Event Kit u i Framework Ref

Constants

EKEventEditViewActionDescribes the action the user took to end editing.

typedef enum { EKEventEditViewActionCanceled, EKEventEditViewActionSaved, EKEventEditViewActionDeleted} EKEventEditViewAction;

ConstantsEKEventEditViewActionCanceled

The user canceled the changes made to the event.

Available in iOS 4.0 and later.

Declared in EKEventEditViewController.h.

EKEventEditViewActionSavedThe user saved the changes made to the event.

Available in iOS 4.0 and later.

Declared in EKEventEditViewController.h.

EKEventEditViewActionDeletedThe user deleted the event.

Available in iOS 4.0 and later.

Declared in EKEventEditViewController.h.

Constants 212010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 3

EKEventEditViewDelegate Protocol Reference

Page 22: Event Kit u i Framework Ref

22 Constants2010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 3

EKEventEditViewDelegate Protocol Reference

Page 23: Event Kit u i Framework Ref

Conforms to NSObject

Framework /System/Library/Frameworks/EventKitUI.framework

Availability Available in iOS 4.2 and later.

Declared in EKEventViewController.h

Companion guide Event Kit Programming Guide

Overview

Delegates of an EKEventViewController object conform to this protocol. An event view controller’sdelegate is notified when the event view controller should be closed. It is your responsibility to close theevent view controller and perform any additional desired tasks within this protocol’s method.

Tasks

Delegate Methods

– eventViewController:didCompleteWithAction: (page 23)Invoked when the event view controller should be closed. (required)

Instance Methods

eventViewController:didCompleteWithAction:Invoked when the event view controller should be closed. (required)

- (void)eventViewController:(EKEventViewController *)controllerdidCompleteWithAction:(EKEventViewAction)action

Overview 232010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 4

EKEventViewDelegate Protocol Reference

Page 24: Event Kit u i Framework Ref

Parameterscontroller

The event view controller that should be closed.

actionThe action that was taken to prompt closing the event view controller. See“EKEventViewAction” (page 24) for possible values.

AvailabilityAvailable in iOS 4.2 and later.

Declared InEKEventViewController.h

Constants

EKEventViewActionDescribes the action that was taken to indicate that the event view controller should be closed.

typedef enum { EKEventViewActionDone, EKEventViewActionResponded, EKEventViewActionDeleted} EKEventViewAction;

ConstantsEKEventViewActionDone

The user tapped the Done button.

Available in iOS 4.2 and later.

Declared in EKEventViewController.h.

EKEventViewActionRespondedThe user responded to a pending event invitation and saved it.

Available in iOS 4.2 and later.

Declared in EKEventViewController.h.

EKEventViewActionDeletedThe event was deleted.

Available in iOS 4.2 and later.

Declared in EKEventViewController.h.

24 Constants2010-09-22 | © 2010 Apple Inc. All Rights Reserved.

CHAPTER 4

EKEventViewDelegate Protocol Reference

Page 25: Event Kit u i Framework Ref

This table describes the changes to Event Kit UI Framework Reference.

NotesDate

Added the EKEventViewDelegate protocol.2010-09-22

New document that describes the view controllers you use to display and editevents.

2010-03-24

252010-09-22 | © 2010 Apple Inc. All Rights Reserved.

REVISION HISTORY

Document Revision History

Page 26: Event Kit u i Framework Ref

262010-09-22 | © 2010 Apple Inc. All Rights Reserved.

REVISION HISTORY

Document Revision History