.iOS.Components.and.Frameworks.

所需积分/C币:10 2015-10-21 09:27:54 7.79MB PDF

想了解iOS的组件和框架技术,就来看看这本书
This page intentionally left blank iOS Components and frameworks Understanding the Advanced Features of the iOS sDK Kyle richter Joe Keeley 六 Addison- Wesley Upper Saddle river, NJ. Boston o Indianapolis. San Francisco New york· Toronto· Montreal· London· Munich· Paris· Madrid Cape Town· Sydney Tokyo· Singapore· Mexico city Many of the designations used by manufacturers and sellers to distinguish their products Editor-in-Chief are claimed as trademarks. Where those designations appear in this book, and the Mark taub publisher was aware of a trademark claim, the designations have been printed with initial Senior Acquisitions capital letters or in all capitals Editor The authors and publisher have taken care in the preparation of this book, but make Trina macdonald no expressed or implied warranty of any kind and assume no responsibility for errors or Development omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein Thomas curtin The publisher offers excellent discounts on this book when ordered in quantity for bulk Managing Editor and content particular to your business, training goals, marketing focus, and branan U purchases or special sales, which may include electronic versions and or custom cover Kristy Hart Project edite interests. For more information, please contact Elaine wiler U.s. Corporate and Government Sales Copy Editor (800)3823419 Cheri clark corpsales@pearsontechgroup.com Indexer For sales outside the United states, please contact Brad Herriman Internatlonal sales Proofreader international@pearsoned com Debbie williams Visit us on the Web: informit. com/aw Technical Reviewers Library of Congress Control Number: 2013944841 Collin ruffenach Copyright o 2014 Pearson Education, Inc Dave Wood Editorial Assistant All rights reserved. Printed in the United States of America. This publication is protected Olivia Basegio by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means Cover Designer electronic, mechanical, photocopying, recording, or likewise. To obtain permission te Chuti Prasertsith use material from this work, please submit a written request to pearson Education, Inc Compositor Permissions Department, One Lake Street, Upper Saddle River, New Jersey, 07458, or Nonie ratcliff you may fax your request to(201)236-3290 AirPlay, AirPort, AirPrint, AirTunes, App Store, Apple, the Apple logo, Apple TV, Aqua Bonjour, the bonjour logo, Cocoa, Cocoa Touch, Cover Flow, Finder, FireWire, Game Center. iMac. Instruments. Interface builder. iCloud. iOS, iPad iPhone iPod. iPod touch, iTunes, the itunes logo, Mac, Mac logo, Macintosh, Mountain Lion, Multi-Touch Objective-C, Passbook, Quartz, QuickTime, Quick Time logo, Safari, Spotlight, and Xcode are trademarks of Apple, Inc, registered in the United States and other countries Facebook and the Facebook logo are trademarks of Facebook, Inc, registered in the United States and other countries. Twitter and the Twitter logo are trademarks of Twitter, Inc registered in the United states and other countries SBN-13:9780-321-856715 lSBN-10:0321-85671-6 Text printed in the United states on recycled paper at edwards brothers malloy in Ann Arbor, Michigan First printing: October 2013 I would like to dedicate this book to my co-workers who continually drive me to never accept the first solution Kyle richte i dedicate this book to my wife, Irene, and two daughters, Audrey and scarlett. your boundless energy and love inspire me daily. Joe keele Contents 1 UlKit Dynamics 1 Sample A Introduction to UIKit Dynamics 2 Implementing UIKit Dynamics 3 Gravity 3 Collisions 4 Attachments 6 Springs 8 Snap 9 Push forces 9 Item Properties 11 In-Depth UIDynamicAnimator and UIDynamicAnimatorDelegate 13 Summary 13 Exercises 14 2 Core Location, Mapkit, and Geofencing 15 The Sample App 15 Obtaining User Location 15 Requirements and Permissions 16 Checking for Services 19 Starting location request 20 Parsing and Understanding Location Data 22 Significant Change Notifications 23 Using GPX Files to Test Specific Locations 24 Displaying Maps 26 Understanding the Coordinate systems 26 MKMapKit Configuration and customization 26 Responding to User Interactions 28 Map Annotations and Overlays 29 Adding Annotations 29 Displaying Standard and Custom Annotation Views 32 Draggable Annotation views 35 Working with Map Overlays 36 Contents Geocoding and Reverse-Geocoding 37 Geocoding an Address 37 Reverse-Geocoding a Location 4: cing 44 Checking for Regional Monitoring Capability 44 Defining boundaries 45 Monitoring Changes 46 48 Summary 52 Exercises 53 3 Leaderboards 55 Whack-a-Cac 55 Spawning a Cactus 57 Cactus Interaction 60 Displaying Life and Score 62 Pausing and Resuming 63 Final Thoughts on Whack-a-Cac 64 iTunes connect 65 Game Center Manager 68 Auth ating 70 Common Authentication Errors 71 ios 6 Authentication 73 Submitting Scores 75 Adding Scores to Whack-a-Cac 78 Presenting Leaderboards 80 Score Challenges 82 Going Further with Leaderboards 84 Summary 86 Exercises 86 4 Achievements 87 Connect 87 Displaying Achievement Progress 89 Game Center Manager and Authentication 91 The achievement cache 91 Reporting Achievements 93 iii Contents Adding Achievement Hooks 95 Completion Banners 96 Achievement Challenges 97 Adding Achievements into Whack-a-Cac 100 Earned or Unearned achievements 101 Partially Earned Achievements 102 Multiple Session Achievements 104 Piggybacked Achievements and Storing Achievement Precision 105 Timer-Based Achievements 106 Resetting Achievements 107 Going further with achievements 108 Summary 110 Exercises 110 5 Getting Started with Address Book 111 Why Address Book Support Is Important 111 Limitations of Address Book Programming 112 Introduction to the Sample App 112 Getting Address Book Up and Running 112 Reading data from the Address Book 115 Reading Multivalues from the Address Book 116 Understanding Address Book Labels 117 Working with Addresses 118 Address book Graphical User Interface 120 People picker 120 Programmatically Creating Contacts 125 Summary 128 Exercises 128 6 Working with Music Libraries 129 Introduction to the sample App 129 Building a Playback Engine 131 Registering for Playback Notifications 131 User Controls 133 Handling State Changes 135 Contents Duration and Timers 139 Shuffle and Repeat 140 Medⅰ a picker141 Programmatic Picker 143 Playing a Random Song 144 Predicate Song Matching 145 147 Exercises 148 7 Working with and Parsing json 149 JSoN 149 Benefits of Using JSoN 149 JSON Resources 150 Sample App Overview 150 Accessing the Server 150 Getting JSoN from the Server 151 Building the request 151 Inspecting the Response 152 Parsing jSoN 153 Displaying the Data 154 Posting a message 155 Encoding JSON 156 Sending json to the Server 158 Summary 159 ise 159 8 Getting Started with icloud 161 The sample app 161 Setting Up the App for iCloud Support 162 Account Setup 162 Enabling iCloud Capabilities 163 Initializing iCloud 164 Introducing UIDocument 165 Subclassing UIDocument 165 Interacting with UIDocument 167 Interacting with iCloud 168 Listing documents in icloud 168 Detecting Conflicts in iCloud 172

...展开详情
img

关注 私信 TA的资源

上传资源赚积分,得勋章
最新资源