1. Create a string
(1) Constant string
Copy Code code as follows:
NSString *string = @ "I am an iosdevtip!";
(2) Common methods of Creation
Copy Code code as follows:
NSString *string = [[NSString alloc] init];
An analysis of KVO examples
Recently encountered a problem, in the process of a comment interface in the project, because the direct use of the UIWebView to display a list of comments, the results of the page up and down there is a cgsize (320,65)
1, first come to a few commonly used:
is the HD screen
#define Isretina ([UIScreen instancesrespondtoselector: @selector (currentmode)]? Cgsizeequaltosize (Cgsizemake (640, 960), [[UIScreen Mainscreen] currentmode].size): NO)
//whether
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
The string is a very important and commonly used part of OC, the string in OC is different from the string I learned in C,c++,java, which is very similar to the concept of container in C + +, but the usage is still very different from it. Maybe it's
First, the knowledge point:QQ Chat InterfaceUse of dual models (Datamodel and Framemodel)Use of UitextfieldUse of notificationsTwo ways to stretch a picture (the Resizeableimagewithcapinsets property of a Slicing/image object)EnumerationExtraction
Use of random numbers in Objective-c (3 types: Arc4random (), Random (), ccrandom_0_1 ())1, the use of random numbers 1), arc4random () more precise do not need to generate the seed immediatelyHow to use:The code for obtaining an integer between 0
When Apple released Xcode7, it not only upgraded the SWIFT programming language to version 2.0, but also made many improvements to objective-c, including the introduction of __nonnull/__nullable. Among them, for the OBJECTIVE-C programming language
First, block syntaxBlocks: Block syntax, which is essentially an anonymous function (a function without a name), the implementation of the block variable holding function, which can be directly adjusted by the block variable. There is no
Block blocks of code/* What the block wants to know 1> how to define the block variable int (^sumblock) (int, int), void (^myblock) (), 2> How to use block encapsulation code ^ (int a, int b) { return a-B; }; ^ () {NSLog (@ "----------");}; ^ {NSLog
Block is an OC extension to ANSI C, using blocks to better simplify OC programming, and many of OC's APIs are dependent on blocks.First, block(a), block of the use of the methodThe syntax format is as follows:^ [block return value type] (parameter 1,
Block is equivalent to the function pointer in C or C ++, and is equivalent to the delegate in. Net or Java.
// Block Declaration
Double (^ blockname) (double, double) =
^ Double (double firstparam, double secondparam ){
Return firstparam *
Posing, as its name implies, means "impersonating". It is similar to categories, but essentially it is different. The purpose of posing is that sub-classes can impersonate parent classes, so that subsequent Code does not need to change the parent
Protocol in objective-C is the same as the interface in Java and the pure virtual class in C ++. Essentially, protocol is used for a communication protocol to be followed by a class, in this sense,
The objective-C protocol may be more appropriate.
1
Objective-C RuntimeDescribes the MACOs objective-C Runtime Library support functions and data structures. overview (overview) the definition of runtime in the official document the objective-C Runtime is a Runtime Library that provides support for
1. It is used to notify an object of what to do, that is, the notification object executes an action.
1.1. in objective-C, square brackets also have other meanings: they are used to notify an object of what to do.
For example:
[Shape draw];// This
Document directory
Method swizzling is not Atomic
Changes behavior of un-owned code
Possible naming conflicts
Swizzling changes the method's arguments
The order of swizzles matters
Difficult to understand (looks recursive)
Difficult to
Nsdictionary serves the same purpose as the dictionary in Java and provides a set of "healthy-value" pairs.
For example, the dictionary is used to store employee numbers into employee names. The number is a key (unique) and the name is a
I bought this book "Learn objective-C on Mac". At the beginning, I bought a 250 page that looks quite thin. After reading it, I found that there are many common languages, the new features are all similar to those in C ++ and Java, that is, a new
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