This article mainly introduces the object pointer and the basic data type in iOS how to make a strong turn, the following words do not say more directly to see the example detailed.
One, the object pointer's strong turn:
UIView *view = [UIView new];//new An object of UIView class Uilabel
= (*label *) Uilabel Strong to view;//pointer
Uilabel = @ "123 "//Assign value to label's Text property (call SetText method of label)
The above code will have a crash and crash message as follows:
-[uiview SetText:]: Unrecognized selector sent to instance 0x7ff1e14e03a0
Summary: The strong-turn object pointer does not change the memory stored in the object type, what is originally the object of the class, the strong turn will not change, but can easily invoke the strong to go to the class of methods and properties.
Two, C basic data type of strong transfer:
float weight = 60.12;
NSLog (@ "%d", (int) weight);
Printed information is: 60
The original value was changed by a strong change: 0.12 discarded
int height =;
NSLog (@ "%f", (float) height);
Printed information is: 70.000000
On the basis of the original value added. 000000 is a float type, perhaps only after a strong turn can be used%f correctly print the value of the height
Because
int height =;
NSLog (@ "%f", height);
Printed information is: 0.000000
The search for a strong transfer of the C basic data type is for reference only.
Summarize
The above is the entire content of this article, I hope the content of this article for your iOS developers can help, if you have questions you can message exchange.