Memory Management principles:
As long as someone else is using this object, the object will not be recycled;
As long as you want to use this object, then you should let the object reference counter +1;
When you do not want to use
First, what is InstancetypeInstancetype is clang 3.5, a keyword provided by clang that represents an unknown type of objective-c object returned by a method. We all know that an object of an unknown type can be represented by an ID keyword, so why
This time the main content is block, for beginners, the code involved in the content of the block is really easy to confuse. First of all, the concept of block, block is an apple for C, C + + and OC add a feature, it contains a part of the code, can
Setobject:forkey: Is the method of the Nsmutabledictionary classThe key parameter type can be any type of objectvalue cannot be nil, or it will be an error Setvalue:forkey: Is the method of the NSObject class, which means that all OC objects have
In general, OBJECTIVE-C access member variable visibility is the same as C + +, just a few @package. The following is a detailed description:Example:@interface ctperson:nsobject{ @private int _age; @protected *_name; @public Double
category and associative as the extension mechanism of the objective-c two features, category is the type, you can extend the method through it, associative, you can extend the property through it, in iOS development, Perhaps the category is more
Directory of this document
I. Introduction to Grammar
Ii. creating a class for the first OC with Xcode
Third, code parsing of the first class
Iv. Adding member variables
V. METHODS of Addition
Vi. comparison with Java
1,assign:Simple assignment without changing the index countSuppose you allocate a piece of memory with malloc and assign its address to pointer a, and then you want pointer b to share the memory, so you assign a to (assign) B. At this time A and B
Table of Contents
Object model (structure definition, class object, Meta class, and instance object relationships)
Message delivery and forwarding mechanisms
Runtime System Functional Understanding
Object model Structure
Today I learned several ways to pass the value ... Just sticking to the notes from the class.
I don't know what it's called. Use variables to pass values
Firstviewcontroller *FIRSTVC = [[Firstviewcontroller alloc] init];
Classes and Objects#import是include的升级版, you can automatically prevent duplicate inclusion, so note: Everyone will use import when the header file is introducedFoundation is a framework, Foundation.h is the main header file of the foundation
. h declaration File1 //Integer.h2 //02-MRC3 //4 //Created by Ma C on 15/8/13.5 //Copyright (c) 2015 BJSXT. All rights reserved.6 //7 8 #import9 Ten @interfaceInteger:nsobject One @property (nonatomic,assign) Nsinteger i; A-(ID) Initwithi:
References in this document (HTTP://WWW.CSDN.NET/ARTICLE/2015-06-01/2824818-OBJECTIVE-C-STYLE-GUIDE/1)With good coding standards, we can keep our code elegant, easy to read and easy to maintain. We're going to start with the following points.1. Code
Stringstring divided into variable string and immutable stringhow immutable strings are initializedNSString *string = [[NSString alloc] init];NSString *string = [NSString string];string is not a container class cannot add data NSString *string =
Objective-c language uses "message structure" rather than "function call"The message structure is represented as follows:// messageing (objective-c) New ]; [obj Performwith:parameter and:parameter2];The function call is represented as follows://
1. There are often some variables in the class that require set and get operations, and OC provides convenient attribute @property to replace the set and get methods, which reduces the frequent and simple duplication of code. The following
The syntax for declaring property is:@ Property (attribute [, attribute 2,...])Type name;
There are three types of attributes:
1. read/write attributes (writability) include: readwrite/readonly
2. setter semantics (setter semantics) includes:
@ Class keywordsTo import a certain type of functional code, you need to include this class. h file. If you only need to know that this object is a class (for example, the following declaration in a file: person * person;), you can use @ class
In objective-C, in fact, like all programming languages, the plus sign (+) is used when two numbers are added, and the minus sign (-) is used when two numbers are subtracted (-), use the multiplication sign (*) When two numbers are multiplied, and
C ++ and objective-C
Using C ++ with objective-CApple's objective-C compiler allows users to freely mix C ++ and objective-C in the same source file. The compiled language is objective-C ++. With it, you can use the existing C ++ class library in
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.