Associated Objects mainly has the following three usage scenarios:1. Add a private variable for the existing class to help implement the details2. Add the public attribute to the existing class;3. Create an associated observer for KVO.There are 3
Inheritance relationships for classes
Compound relationship: Has aInheritance relationship: is aConsider this question:When you write cat and dog classes, you'll find that there are a lot of the same or similar properties and methods in these
OBJECTIVE-C Memory Management
Management Category: OC objectsThe memory resources that each computer system can use for the program are limited. There are two things we should care about:Allocate when needed, release after useDo not use any
Auto Free Pool
is a semi-automatic memory management methodAutorealease Method:-(Instancetype) autoreleaseThis method places the object in the auto-free pool, and all objects in the pool are destroyed when the pool is automatically freed.Common
First post the code in the previous article using @property and @synthesize, and then explain the usage and meaning of these two keyword, such as the following code:Person.h file#import @interface person:nsobject { int _age; Be able to access
1, used to inform an object what to do, that is, to notify the object to perform an action. In Objective-c, the meaning of "[]": They are used to inform an object what to do. The behavior of this notification object to perform an operation is called
Self,superSelf is understood as this in C + +, and when the method is called with self, the lookup starts from the current class, and the previous parent class is not searched in turn.Super is the parent class, and you can call the method of the
Today, the content of the study is relatively small, mainly the teacher informed to determine the subject, found some information, and ultimately decided to make a route record of the app.Some quick actions:Disable all breakpoints, command + Y. h
The classification in objective-c allows us to augment it by adding a method to a class (but we cannot add new instance variables through category), and we do not need to access the code in the class.The protocol in OBJECTIVE-C is a ubiquitous
Http://www.cnblogs.com/ygm900/archive/2013/01/16/2862678.htmlWe all know that Objective C cannot support multiple inheritance like C + +, but the use of OC often encounters situations where multiple inheritance is required. For example, there are
In Objective-c, you use @property to identify the attribute (typically an instance variable). Use the @synthesize to identify the variables declared in the implementation file, allowing the system to automatically generate the Set method and get
The block function is a function pointer-like function, the programmer only need to put the code needs to be encapsulated in the definition of the block can be used in the future, the direct invocation, very convenient ....Examples are as
Object (the instance object of the Class). In short, it's a piece of data in memory that holds the value of an attribute through an instance variable .
The use of the object. Create object------Send Message---------Release object (sets the
Block internal structureLet's write a blockvoid Exampleblock () { //nsconcretestackblock int a = 1; __block int b = 2; Int (^blocktest0) (int c) = ^ (int c) { return a + B + C; }; int c = 3; BlockTest0 (c);
1, Introduction:The property is a objective-c keyword, used in pairing with @synthesize , to allow the compiler to automatically generate a method declaration with the same name as the data member. @synthesize is the implementation that is used to
UITableViewCell: Custom cells, you can create cells in xib, or you can create cells in Storyborad. There are four ways to create cells created in Storyborad, which are static cells, are available at the beginning of the cell and can be loaded
Custom views are now a bit confusing, with a rough idea of how to write:1. Create a new view controller that designates this view controller as the root View Controller for window2. Customize the view Ltview, explicitly ltview the internal controls,
rules for memory management :1.alloc created must be freed, convenience constructor created do not release2. Objects added to the container are executed once retain operation, reference count plus 13. The container removes the object and sends a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service