Singleton mode may be one of the most commonly used patterns in iOS development, but due to the language characteristics of OC itself, it is relatively troublesome to write a correct singleton mode, here I would like to talk about the design of the
1#pragmaMark---------------Variable Array-----------------2//can be used in the array to delete and modify the operation3//4//variable arrays are related to arrays: mutable arrays are subclasses of arrays,5//How to initialize a mutable
If the life cycle of an object is obvious, it is easy to know when the new object is to be used and when it is no longer needed, in which case the manual retain and release are used directly to determine its survival and death. But sometimes it's
Empty lines are not required before and after @interface,@implementation , and @end . If you declare an instance variable in the @interface , you must have an empty line after the closing parenthesis } .Space vs. tabUse only spaces, and indent two
1. What is block?① block syntax, essentially an anonymous function (a function without a name);②block is a data type in OC and is widely used in iOS development.③^ is the unique mark of block;The implementation code of the ④block is included in the {
No matter which programmer, or what computer language to learn, the first program written is basically Hello world. Today we use OC to implement the first program: Hello World.Select Create a new project in Xcode, select OS X in the dialog box,
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
1 about __block variable Why can I change the value in block
1 2 3 4 5 6 7 8 9 Ten One A - -
void foo(){ __block int i = 1024;//此时i在栈上 int j = 1;//此时j在栈上 void (^blk)(void); blk = ^{printf("%d, %d\n", i, j);
First, the concept:Object-oriented provides inheritance syntax that can greatly simplify code. The common methods and instance variables are written in the parent class, and the subclass words need to write their own unique instance variables and
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
OBJECTIVE-C Study Notes1. Use #import Import header file, General OSX command line development using , GUI development use The string in 2.OC is no longer an array, but instead becomes an object of type NSString, where the string is the object, and
Atomic: A primitive operation that guarantees the setter/getter of these two methods. If more than one thread calls the setter at the same time, one thread does not appear before the all-setter statement, and the other thread starts to perform the
Minimize the introduction of additional header files in the header file of the classUse "forward declaration" to introduce header files when there is a need, reducing the number of header files that the class's users need to introduce, and reducing
------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------Class, object, method related knowledge notesObjective-c has object-oriented features relative to C, but OBJC has no other grammatical
Nsset to tell the truth, the application of this class, still do not know when the end will be used, first over the brain, after the need to use the time, not unfamiliar!#import int main (int argc, const char * argv[]) {@autoreleasepool {Create 4
int is a static typeNsinteger is a dynamic typeApple's official recommendation is to use Nsinteger, because in Apple's API implementation, Nsinteger is a package that recognizes the number of bits in the current operating system and automatically
Pre-compilation Directives1. It is best to use double quotation marks to write your own header files, and the system can use angle brackets.*************************************************Dot syntaxP.age= 10;1. Instead of accessing the age member
One. Basic data types1. General computer language when defining variables, you need to provide two content: type and name.For example: int myclassid;2. In Xcode, whether you are using the GCC compiler or the LLVM compiler, if we do not initialize
In the previous article, we introduced the class-and object-related content in runtime, and from this chapter we will discuss the content of class implementation details, including the implementation of member variables, properties, methods,
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