iOS 7 Programming Fundamentals

所需积分/C币:16 2015-10-21 09:26:49 11.03MB PDF

iOS7开发基础教材,包含Object-C语法,XCode工具和Cocoa库等,入门必备
10S 7 Programming Fundamentals Objective-C, Xcode, and Cocoa Basics Matt Neubl Beijing· Cambridge.mham·Kh· Sebastopol. TokyoOREILLY iOS 7 Programming fundamentals by Matt Neuburg Copyright@ 2014 Matt Neuburg. All rights reserved Printed in the United States of america Published by O reilly Media, Inc, 1005 Gravenstein Highway North, Sebastopol, CA 95472 OReilly books may be purchased for educational, business, or sales promotional use Online editions are alsoavailableformosttitles(http://my.safaribooksonline.com).fOrmoreinformation,contactourcorporate institutionalsalesdepartment800-998-9938orcorporate@oreilly.com Editor: Rachel roumeliotis Cover Designer: Karen Montgomery Production Editor: Kristen Brown Interior Designer David Futato Proofreader: O'Reilly Production Services Illustrator: Matt Neuburg Indexer: Matt Neuburg October 2013: First edition Revision History for the First Edition: 2013-10-10 First release Seehttp://oreilly.com/catalog/errata.csp?isbn=9781491945575forreleasedetails Nutshell Handbook, the Nutshell Handbook logo, and the O Reilly logo are registered trademarks ofO Reilly Media, Inc. iOS 7 Programming Fundamentals, the image of a harp seal, and related trade dress are trade marks of o Reilly media, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O Reilly Media, Inc, was aware of a trade mark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility forerrors or omissions, or for damages resulting from the use of the information contained herein ISBN:978-1-491-94557-5 Table of contents Preface Part I. Language Just Enough C............ Compilation, Statements, and Comments Variable Declaration, Initialization, and Data Types 3569 Structs Pointers arrays 13 Operator 15 Flow Control and conditions 17 Functions 21 Pointer Parameters and the Address Operator 24 file 25 The Standard library 29 More Preprocessor directive 30 Data Type Qualifiers 31 2. Object-Based Programming 33 Objects Messages and methods 34 Classes and Instances 35 Class Methods 37 Instance variables 38 The Object-Based Philosophy 3. Objective-C Objects and messages 45 An Object reference Is a pointer Instance References, Initialization and nil 47 Instance References and Assignment 50 Instance References and memory management 51 Methods and Messages 52 Calling a method 53 Declaring a method 54 Nesting Method calls 55 No Overloading 56 Parameter lists 57 When Message Sending Goes Wrong 58 Messages to nil Unrecognized Selectors Typecasting and the id Type 61 Messages as Data pe C Functions 67 CFTypeRefs 68 Blocks 9 4. Objective-C Classes 75 Subclass and superclass 75 Interface and Implementation 77 Header File and Implementation File 79 Class Methods 81 The Secret Life of classes 82 5. Objective-C Instances. ,85 How Instances are created 85 Ready- Made Instances 85 Instantiation from Scratch 86 Nib-Based Instantiation Polymorphism 91 The Keyword self 93 The Keyword super 97 Instance variables and accessors 8 Key-Value Coding 101 Propert 103 Table of contents How to Write an initializer 104 Referring to instances 108 Part l. DE 6. Anatomy of an Xcode project ....................... 113 114 The Project Window 116 The Navigator Pane The Utilities pane 123 The editor 124 The Project File and Its Dependents 127 The t 130 Build phases 131 Build settings 133 Configurations 134 Schemes and destinations 135 Renaming parts of a project 138 From Project to Running App 139 Build Settings 141 Property list settings 142 Nib files 143 Additional resources Code and the App Launch Process 146 Frameworks and SDKs 150 7. Nib Management.............................155 A Tour of the nib editor interface 156 The document outline 158 Canvas 161 Inspectors and Libraries 163 Nib Loading 164 Outlets and the nib owner 167 Creating an outlet 172 Misconfiguring an outlet 174 Deleting an Outlet 175 More ways to Create Outlets 176 Outlet collections 180 Action Connections 180 Table of Contents Additional Initialization of Nib-Based Instances 183 8. Documentation 187 The Documentation window 188 Class Documentation Page 190 ample code 193 Other Resources 194 Quick Help 194 Symbols 195 Header files 196 Internet resources 197 9. Life cycle of a Project ,199 Device architecture and Conditional code 199 Version Control 203 Editing Your Code 206 Autocompletion 207 Snippets 209 Fix-it and Live Syntax Checking 209 Navigating your code 210 Running in the simulator 213 Debugging 214 Caveman Debugging 214 The Xcode Debugger 217 Unit testin g 223 Static analyzer 227 Clean 229 Running on a device 230 Obtaining a certificate 233 Obtaining a Development Provisioning Profile 235 Running the app 237 Profile and Device Management 237 Gauges and Instruments 238 Localization 244 Archiving and Distribution 249 Ad Hoc distribution 251 Final App Preparations 252 Icons in the app 253 Other icons 255 Launch images 256 ⅵi| Table of contents Screenshots 257 Property List Settings 258 Submission to the App store 260 PartⅢ. Cocoa 10.〔 ocoa classes ,265 Subclassing g 265 Categories 268 Splitting a class 270 Class extensions 271 Protocols 272 Informal Protocols 276 Optional method 277 Some foundation classes 278 Useful Structs and Constants 278 NSString and friends 279 NSDate and friends 281 NSNumber 282 NSValue 284 NSData 284 Equality and comparison 284 NSIndexSet 285 NSArray and NSMutableArray 286 NSSet and friends 288 NSDictionary and NSMutableDictionary 288 NSNull 291 Immutable and mutable 291 P 292 The Secret Life of NSobject 293 11. Cocoa Events 297 Reasons for Events 298 Subclassing 298 Notifications 300 Receiving a notification 301 Unregistering 303 Posting a notification 304 NSTimer 305 Table of contents|ⅶi Delegation 306 Cocoa Delegati 306 Implementing Delegation 308 Data sources 311 Actions 312 The Responder chain 315 Deferring Responsibility 316 Nil-Targeted Actions 316 Swamped by events 317 Delayed Performance 320 12. Accessors and Memory Management. 323 Accessors 323 Key-Value Coding 324 KVC and outlets 326 Key paths 327 array accessors 328 Memory management 329 Principles of Cocoa Memory Management 330 The rules of cocoa manual memory management 331 What Arc is and what it does 334 How Cocoa Objects Manage memory 336 Autorelease 338 Memory Management of Instance Variables(Non-ARC) 341 Memory Management of Instance Variables(ARC) 345 Retain Cycles and Weak references 346 Unusual Memory management Situations 349 Nib loading and memory management 354 Memory Management of Global Variables 355 Memory management of CFTypeRefs 356 Memory management of Pointer-to-Void Context Info 359 Properties 361 Property memory management policies 362 Property Declaration Syntax 363 Property Accessor Synthesis 365 Dynamic accessors 368 13. Communication Between Objects...................... 373 Visibility by instantiation 374 Visibility by relationship 376 I Table of Contents

...展开详情
img

关注 私信 TA的资源

上传资源赚积分,得勋章
相关内容推荐
  • 下载 -

    -