IOS development-OC language (2) design, ios-oc
1. Objective-C (OC)
2. Create a project in XCode
3. OC keywords and @
4. OC variable naming
5. Basic OC Data Types
6. OC definition method
7. id type of OC
8. Differences between NSLog and printf
9. OC-defined string
/*********** Object-oriented *********/
1. object-oriented and process-oriented (for example, how to use object-oriented and process-oriented to explain the book management system separately ).
1.1. What is object-oriented programming?
Object-oriented is to create a class for things with the same attributes in the problem. The class has attributes and methods, and then create an object of the class, call the class attributes and methods to solve the problem.
Focusing on business functions for processes,
Encapsulation and hierarchy of features highlighted by object-oriented
Class: such as fruits, vegetables, people, animals, buildings, computers, students ....... And so on. Classes are abstract and have a large scope.
Target: for example, student James
1.2. Three Characteristics of object-oriented:
1) Encapsulation
Data is encapsulated together with data-based operations. Data is protected within the class, and other parts of the system only pass authorized operations, in order to communicate and interact with this class.
Benefits:
Isolate data
Ease of use
Improve reusability
Improve Security
Encapsulation principles:
Hide content that does not need to be provided externally
Hide all attributes and provide public access
2) Inheritance
A class can be derived from other existing classes. The new class retains the behaviors and attributes of the parent class, but adds new functions.
3) polymorphism
A program can coexist with different methods with the same name.
Override and overload of methods are implemented by defining multiple methods with the same name in the same class.
2. Classes and objects
Abstract objects of the same or similar nature are classes. Therefore, the abstraction of objects is classes, and the embodiment of classes is objects.
3. How to define a class
4. How to define attributes and methods in a class
5. How to instantiate a class.
6. How to set private and protected fields for instance variables
7. setter and getter Methods
8. init Method
9. self and super
10. Pass values with multiple parameters
11. quickly create an object
12. If you define a constructor initWithXXX
13. description Method
14. Class methods and object Methods