This translation is exclusively licensed to SWIFTGG
Original link: objective-c pointers and Swift 2: A Simple Guide
Original Date: 2015/08/23
Translator: Mmoaay
Proofreading: NUMBBBBB
Finalized: Shanksyang
This article
Nsarray, Nsdictionary is not available to store the basic data types in C language. NSNumber can wrap a basic data type into an object, which indirectly saves the base data type into a collection class such as Nsarray, Nsdictionary, and so on. Use
NSNumber is a subclass of Nsvalue, the former can only wrap numbers, the latter may wrap any value. Nsarray, Nsdictionary can only store OC objects and cannot store structures. Therefore, if you want to put the structure in Nsarray, nsdictionary,
Warm so know new, continue to review.In OC, the setter and getter can be omitted by declaring attributes, which makes the code concise. When using attributes, it is not necessary to declare the instance variables in the interface and M files and to
Weak references are too weak to be able to keep in touch with a request for space through this reference. As an example,@interface Classa:nsobject@porperty (nonatomic,weak) ClassA * TEMPCLASS1;@property (Nonatomic,strong) ClassA * TEMPCLASS2;-(void)
Tip: The previous more commonly used 1, the creation of String instance method:?-(Instancetype) Initwithformat: (nsstring*) format formatted to generate a string object? This method is more commonly used, powerful, and uses: [[NSString
. h : header file. Header files contain declarations of classes, types, functions, and constants.. M: source code files. This is a typical source code file extension that can contain objective-c and C code.. MM: source code files. Source code files
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
Learning the UI part of the content today, a bit more, well organized.The first is UIWindow.Direct instantiation of UIView: UIView *view = [[UIView alloc] init];Then set it to size: View.frame = CGRectMake (10,30,355,627); Learn HTML or interface
1.objective-c World of pointersOC has always been a human feeling more perverted language, why? Because each of its variables is pointer-type, many people almost forget the existence of that *.So often a=b the equal sign gives me the illusion that a
NSStringOC provides a way to define a string object, which is to enclose the string you want to express in a pair of double quotation marks, and at the beginning plus @[email protected] is the instruction in OC, which tells the compiler that the
Learning Java We know that the class has three major characteristics, encapsulation, inheritance, polymorphism. In Objective-c, there is also the concept of inheritance, and today we will look at the inheritance and polymorphism in Objective-c.First,
The so-called compound, is the definition of the members of this class is another class of instance methods.That is, the other objects as part of their own, to enhance their own functions,is equivalent to a function nesting in the C language. Here
definition of Class@interface Firstclass:nsobject@end//@interface means declaring a class, ":" Representing an inheritance relationship, @end the end of the classimplementation of the class@implementation FirstClassdeclaration of the method+ (void)
Category is one of the most commonly used functions in objective-c.The category can add methods to existing classes without adding a subclass.The standard syntax format for the category interface is as follows:[CPP]View Plaincopy
#import
Following
void print ();
};
Class ac{
};
At this time, the AI and AC are independent, AC does not have to build a relationship with the AI to compile the error, the following modifications to the AC, the AI
Cocoais a native compilation environment on Mac OS x systems. He contains two frames, which are actually a series of libraries, Foundation and AppKit.On your iphone and other handheld devices, use one of his subcategories-Cocoa Touch. The Foundation
Can you send a message to CGRect? The answer is no, can only send messages to Objective-c object,CGRect is a struct, so no! define several conceptsreceiver(message receiver): Pointer to the object that executes the methodselector(selector): Method
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);
Tableview+scrollview
Add label to cell
Ways to solve ghosting
Delete element when reusing cell
Nsarray *subviews = cell.subviews;For (UIView *view in subviews) {[View Removefromsuperview];}
In the IF
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.