ArticleDirectory
[Obj-C note] "Self = [Super init]" explanation and hidden bugs
[Obj-C note] "Self = [Super init]" explanation and hidden bugs
The recommended init Method for objective-C is written as follows:
-(ID) Init {If (Self = [Super init]) {// Add attributes to the subclass for initialization} return self ;}
Several questions are involved here,
1. [Super init:
Object orientation
This article is a lot of content, from the Internet.Environment: Unity3d 4.1,The Unity3d script implements the color change and rotation of the model, noting that if the model is set to static, it cannot be rotated.Function Description: Mouse drop to model, model color change, press mouse model to start rotation.The script code is as follows:Using unityengine;using System.collections;public class Test:monobehaviour {bool Tri1=false;bool tri2=false; Color orgcolor;//Use this for initializationvoi
This function is a memory Viewing object that returns the object obj. The so-called memory viewing object, is the object conforms to the buffer protocol object, in order to give other code to use the data in the buffer, without having to copy, it can be used directly. Example:#memoryview () v = memoryview (b ' abc123 ') print (v[1]) print (v[0]) Import structbuf = Struct.pack ("i" *12, *list (range (12))) x = Memoryview (buf) y = x.cast (' i ', shape
undefined = "new value"; Alert (undefined)//alerts "new value"Because of this, your cannot safely rely on undefined have the value that's that you expect.Void, on the other hand, cannot is overidden. void 0 would always return.I tested it under Ie10,firefox and chrome, and unfortunately didn't come up with the expected results. Although the above code did not give an error, it did not print out the "new value" we expected.So in general, the use of void 0 is not very meaningful.ReferenceHttp://s
Recently, several projects that use web services use sudzc to generate the obj-C processing code, which has been used very well and very convenient.
Previous projects were non-arc projects. A new project of Arc was established, and sudzc also had the code to generate the arc version, so it was previously used.
When debugging this project today, we found that the results returned by Web services are all nil, but the results returned by the request are
Python standard library: built-in functions: memoryview (obj), pythonmemoryview
This function returns the object obj's memory view object. The so-called memory viewing object is the object that complies with the buffer protocol. In order to use the data in the buffer for other code, you can directly use it without having to copy it.
Example:
# Memoryview () v = memoryview (B 'abc123') print (v [1]) print (v [0]) import structbuf = struct. pack ("
The bin directory is used to store compilation results. Bin is the abbreviation of binary binrary, because the program files compiled by C are binary files.
OBJ is the abbreviation of an object. It is used to store intermediate temporary files generated during compilation.
Both the debug and release sub-directories correspond to the debug and release versions respectively.
Properties is used to define the attributes of an assembly.
Aspx is the Asp
OBJ-C provides an internal counter for each object to track the number of references of the object. The increase and decrease of the number of references correspond to the retain and release methods of nsobject respectively. When the number of references is 0, the object will be recycled immediately. The alloc and copy methods of the object will send a retain message, and the reference count will be incremented by 1. "Who gave birth to the child, who
Debug compile normal build, switch to release to report this error.Yesterday with the VS2005 mutation encountered this problem, online search a lot of, tried many not effective. Microsoft This is really a pit father!The ultimate solution: Install SP1 upgrade package, go to search: Sp1-kb926601-x86-enu bar. (I use the English version of VS2005, so here is the English version), the other solutions on the Internet are nonsense, wasting time.There is another way: Upgrade VS, we recommend the use of
I was almost killed by a very low-level problem recently and can easily describe it clearly, so it must be recorded.
I downloaded a demo from someone else a few days ago, and then configured the compilation to run normally under Debug. The release configuration was basically copied, And the Link error occurred during compilation.
1> link: Fatal error lnk1181: cannot open input file 'xxx. OBJ ',It took two days to discover the problem. The reason
Filters out the collection of elements that match the specified expression, which is used to narrow the matching range, separating multiple expressions with commasWhen a parameter is a function, the parameters inside the function are interpreted as follows:A function is used as a collection of test elements. It accepts a parameter index, which is an element in the jquery collection. In the function, this refers to the current DOM elementExample: The jquery filter filter (EXPR|
The value of the CSS property of the set element can be used with the style property of elements, where the dom.style.attr is mostly undefined;Dom.style.attr is used to get the inline style, and now the page is basically an outer chain style sheet so that the value is not obtained; so it can only be undefined;How do you get it, or set its style? There is a GetStyle () method below:This will be available at the time of acquisition.GetStyle (obj, attr)
Reasons and benefits of using quot; return obj ==void 0 quot; in javascript
When I learned about underscore. js, I found that the following code often appears in the source code:
if (context === void 0) return func;if (array == null) return void 0;
I have never seen this method before. I searched some materials on the Internet and found that some people in stackoverflow raised similar questions. Here we will summarize and take a note. Void is actua
$.each (obj, FN)
Each (function (I,item) {})
A general iterative function that can be used to approximate an object and array.
This function differs from $ (). each (), which is a function designed to iterate and execute the jquery object. This function can be used to iterate over any object and array. The callback for this function contains two parameters: the first is a key (object) or index (array), and the second is a value.
return value: Obje
. \OBJ\TEMPLET.SCT (7): Error:L6236E:No section matches selector-no sections to be first/last.
This error has always occurred when using KEIL4 to compile the connection project, which is a bit strange; devices is 32f101rb, the boot file is. MDS, so
Flash selection should not be a problem. However, replace the. MDs with. HDS without error. Found on the Internet, try to configure the next linker, but still not.
Helpless under will. The SCT file was e
attributes such as retain,assign. This method of assignment is a simple pointer assignment.To sum up, the member variables are assigned to the points to be aware of in order to prevent memory leaks:1.self how to invoke setter methodsobjectname* tmp= [[ObjectName alloc] init];Self.namevarptr =tmp; retaincount=2[TMP release]; Retaincount=12. Pointer assignment method does not call setter methodsnamevarptr= [[ObjectName alloc] init];//Retaincount=1Therefore, I suggest that everyone in the assignme
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.