Programing with objective c

Được đăng lên bởi Beo Nhu Muom
Số trang: 128 trang   |   Lượt xem: 529 lần   |   Lượt tải: 2 lần
Programming with


About Objective-C 7
At a Glance 7
An App Is Built from a Network of Objects 7
Categories Extend Existing Classes 8
Protocols Define Messaging Contracts 8
Values and Collections Are Often Represented as Objective-C Objects 8
Blocks Simplify Common Tasks 9
Error Objects Are Used for Runtime Problems 9
Objective-C Code Follows Established Conventions 9
Prerequisites 10
See Also 10

Defining Classes 11
Classes Are Blueprints for Objects 11
Mutability Determines Whether a Represented Value Can Be Changed 12
Classes Inherit from Other Classes 12
The Root Class Provides Base Functionality 14
The Interface for a Class Defines Expected Interactions 15
Basic Syntax 15
Properties Control Access to an Object’s Values 15
Method Declarations Indicate the Messages an Object Can Receive 17
Class Names Must Be Unique 19
The Implementation of a Class Provides Its Internal Behavior 20
Basic Syntax 21
Implementing Methods 21
Objective-C Classes Are also Objects 22
Exercises 23

Working with Objects 24
Objects Send and Receive Messages 24
Use Pointers to Keep Track of Objects 26
You Can Pass Objects for Method Parameters 27
Methods Can Return Values 28
Objects Can Send Messages to Themselves 30

2014-09-17 | Copyright © 2014 Apple Inc. All Rights Reserved.



Objects Can Call Methods Implemented by Their Superclasses 31
Objects Are Created Dynamically 34
Initializer Methods Can Take Arguments 36
Class Factory Methods Are an Alternative to Allocation and Initialization 36
Use new to Create an Object If No Arguments Are Needed for Initialization 37
Literals Offer a Concise Object-Creation Syntax 37
Objective-C Is a Dynamic Language 38
Determining Equality of Objects 39
Working with nil 40
Exercises 41

Encapsulating Data 43
Properties Encapsulate an Object’s Values 43
Declare Public Properties for Exposed Data 43
Use Accessor Methods to Get or Set Property Values 44
Dot Syntax Is a Concise Alternative to Accessor Method Calls 45
Most Properties Are Backed by Instance Variables 46
Access Instance Variables Directly from Initializer Methods 48
You Can Implement Custom Accessor Methods 51
Properties Are Atomic by Default 52
Manage the Object Graph through Ownership and Responsibility 53
Avoid Strong Reference Cycles 58
Use Strong and Weak Declarations to Manage Ownership 61
Use Unsafe Unretained References for Some Classes 64
Copy Properties Maintain Their Own Copies 64
Exercises 66

Customizing Existing Classes 68
Categories Add...
Programming with
Programing with objective c - Trang 2
Để xem tài liệu đầy đủ. Xin vui lòng
Programing with objective c - Người đăng: Beo Nhu Muom
5 Tài liệu rất hay! Được đăng lên bởi - 1 giờ trước Đúng là cái mình đang tìm. Rất hay và bổ ích. Cảm ơn bạn!
128 Vietnamese
Programing with objective c 9 10 385