Add a "property" to a categoryWe know that you can add methods to a category, but you can't add properties . Do we have another way to do that?Let's take a look at the following code:@interface UIView (nl_Frame)@property (nonatomicassignCGFloat
First, learn about OC beforeIntroduction to OC Syntax
Keywords begin with @;
The string starts with @, such as NSLog (@ "I love iOS.");
Import can automatically prevent the contents of the file from being copied repeatedly;
@class and #importDescriptionA forward reference was created @class. This is telling the compiler: "Trust me." You will naturally know what this class is, but now you know it is enough. ”@class can also be useful if you have circular dependencies.
Naming conventions:For the naming of access methods, cocoa has its own conventions. When writing access methods for your own classes, you should follow these conventions so that you and others can read the code without being confused.The setter
The NSString and Nsattributedstring classes in Cocoa Foundation provide us with support for Unicode strings, the biggest difference between NSString and nsattributedstring classes is: nsstring-- the content and length of the string cannot be
If you have used mrr,autorelease this keyword should be too familiar, each time we generate a new object return, we need to send an autorelease message to this object, in order to delay the release of the created object. When is it that the object
Main.m1 #import2 #import "Person.h"3 /**4 Nssortdescriptor can be sorted by the properties of the object, and multiple attribute ordering is supported. For example, we have a person object that has a name and age two attributes, and we need to
Introduction to Associations in OBJECTIVE-CReprint please indicate the source of CSDN blog:http://blog.csdn.net/daiyibo123/article/details/46471993How to set associationsWe can use the following methods to correlate properties:objectconstvoidvalue,
Whether an instance object in Objective-c supports a copy operation depends on whether the object implements the Nscopying protocol:@protocol nscopying-(ID) Copywithzone: (Nszone *) zone; @endFor mutablecopy operations, there is a nsmutablecopying
Autorelease detailed/ * Basic usage of 1.autorelease 1> objects are placed in an auto-free pool 2> when the auto-free pool is destroyed, all objects inside the pool are released once 3> returns the object itself 4> After calling the Autorelease
Brief introductionBased on the C language, you can build a class that requires two files by writing a single-C + + code: . h's header file . m implementation file (if it is a mixed-C + + file with a. mm file suffix) Since there is a header file, so
KVC key value pair is later in the development of the project will often use, if it is not clear that is key, that is value, then it will be very disadvantage, I personally is in this area to eat a lot of loss, especially in the Address book. Maybe
First, the attributeThe objective-c property is the syntax defined by the 2.0, which provides a setter for instance variables, a default implementation of Getter methods that simplifies program code to some extent, and enhances access security for
Memory Management policyThe basic model for memory management is defined in the NSObject protocol and standard method naming conventions in the combination method provided in the reference counting environment. The NSObject class also defines a
An array of objective-c is more powerful than an array of C++,java, and Nsarray saved objects can be different objects. But can only save objects, int, char,double and other basic data types can not be saved directly, you need to convert to an
Today the main practice nsstring nsmutablestring Nsarray NsmutablearrayNSString ( string)Method 1: [[NSString alloc] initwithformat:@ ""] creates a string object, formats it, and assigns a value to the string object method 2:stringwithformat:@ ""
The contents of these days are mostly methods, may be seen in the time feel there is nothing to learn, but these things will be involved in the follow-up, it is best to be able to knock again, so in the back of the time will not feel
First, look at the typical nsstring and Cfstringref conversions.http://www.tuicool.com/articles/MJRr226Cfstringref to nsstring *nsstring *yourfriendlynsstring = (__bridge NSString *) yourfriendlycfstring; //NSString * to Cfstringrefcfstringref
1: Overall steps for data refresh1.1: Modifying model data1.2: Refresh table (Refresh interface)2: How to refresh the table Global Refresh (each row will be refreshed)-(void) reloaddata; // Partial Refresh (use premise: number of model data
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