Towards the programming of the Sunshine Boulevard

Source: Internet
Author: User

Unlimited connected learning Notes serial second week

Time flies, in the blink of an eye in the infinite connected learning has been a week, in the past week, the C language has been re-reviewed, although it is a learned language, but still from a lot of learning, this week and contact with a new object-oriented programming language--objiect C, it and C language has a lot of similarities, Now the basic knowledge of OC is briefly summed up, the back will be updated again.

Data types in 1.oc:
650) this.width=650; "alt=" Picture "src=" http://r.photo.store.qq.com/psb?/V11RjONW1QEd2l/ fgyke1snjsa4rmifoyu8dxoewo4l0o18zzyzfdyschm!/o/dadhtw0vfwaa&ek=1&kp=1&pt=0&bo=. Qhjafkb4wedacu!&su=1146988801&sce=0-12-12&rf=2-9 "style=" margin:0px;padding:0px;border-width:0px; border-style:none;vertical-align:top;width:505px;height:483px; "/>
2.OC with #import import a header file, output with NSLog, print time wrap, the output of the string with the output of%@,OC in front to add @

3. Using public to indicate that the properties of a class are externally available, can be changed and used externally, and that member variables are generally protected by default, can only be used in their own classes, if you want to use external, you need to provide an interface to call the outside world, this interface is the method we often say; Can only be used in your own class

4. Assigning a value to a member variable can be done by means of a pointer, provided that the instance variable is public and that this method is not commonly used

5. Create a class that includes instance variables and declarative methods

Method:-(Method Name: (parameter type) parameter name;

When there are multiple parameters: two parameters separated by:. Be aware of this: it is also part of the method name.

6. Invocation of the method: [Instantiated Object Name Method name: Incoming value];

The get get of method can be omitted.

7. Instantiated object: Class Name * Object name = [[Class name Acllo]init];

8. Logo: #pragma mark

9. Calls to internal methods do not need to be passed to the outside world

10. Invocation of the method itself: [Self method name]

11. How to enter a string: After the declaration to open up space. Input string format, converted to a string format in OC using [nsstring stringcstring: string name encoding:nsutf8stringencoding]

650) this.width=650; "alt=" Picture "src=" http://r.photo.store.qq.com/psb?/V11RjONW1QEd2l/ 4o6axsarcpobcb3ngp1u0fd5lqcqz6e8cu90dyosibc!/o/ddye6w5fogaa&ek=1&kp=1&pt=0&bo=wwl7afsc.wadacu! &su=1159504625&sce=0-12-12&rf=2-9 "style=" Margin:0px;padding:0px;border-width:0px;border-style:none ; vertical-align:top;width:603px;height:251px; "/>


In addition, programming is an art, in order to make our code full of artistic sense, I recommend you in programming to have a certain specification, so that not only embodies the beauty of the code, but also greatly improve the readability of the code:

1. Conditional statement body should always be surrounded by curly braces

2. Do not need to use Yoda expressions, that is, to take a constant to compare with the variable

3. Do not put important code in the condition body when writing conditional statements

4. When there is a complex if clause, they should be extracted to assign to a bool variable, which makes the logic clearer

5. The three mesh operator should only be used where it can make the code clearer

6. Naming habits recommend the use of long, descriptive names, as far as possible to use the Hump name method

7. For method signatures, you should have a space after the method type (-/+). There should also be a space between the method segments, and there should always be a descriptive keyword before the parameter name

8. The class name should be prefixed with three uppercase letters, and when creating a subclass, the descriptive part should be placed in the middle of the prefix and the parent class name




http://www.iphonetrain.com/650) this.width=650; "alt=" Picture "src=" http://r.photo.store.qq.com/psb?/V11RjONW1QEd2l/ pz1i4uff3visg6krmflzb6ok3uwuuyk6dvdtuug5sow!/o/dgsuem8ipgaa&ek=1&kp=1&pt=0&bo=bqjmam0czgidacu! &su=134509553&sce=0-12-12&rf=2-9 "style=" margin:0px;padding:0px;border-width:0px;border-style:none; vertical-align:top;width:621px;height:614px; "/>

650) this.width=650; "alt=" Picture "src=" http://a4.qpic.cn/psb?/v11rjonw1qed2l/svhd11cqrmok13sundyglseogsco5e.* Slyb4i2l1zg!/b/doitg28dpgaa&ek=1&kp=1&pt=0&bo=wahtaqaaaaabakw!&su=039146033&sce= 0-12-12&rf=2-9 "style=" margin:0px;padding:0px;border-width:0px;border-style:none;vertical-align:top;width : 344px;height:467px; "/>                  650) this.width=650; "alt=" Picture "src=" http://a2.qpic.cn/psb?/v11rjonw1qed2l/9d7uieitz1hhx0svit* gozpz1th3hba5bkcapt8hbek!/b/ddnptg4clqaa&ek=1&kp=1&pt=0&bo=tac0aaaaaaafacm!&su=012186001 &sce=0-12-12&rf=2-9 "style=" Margin:0px;padding:0px;border-width:0px;border-style:none;vertical-align: Top;font-family:punctuation, ' Microsoft Jas Black ', tohoma;font-size:14px;line-height:22.3999996185303px;white-space:normal; Width:180px;height:180px;background-color:rgb (255,255,255); "/> 


This article from the "10532193" blog, reproduced please contact the author!

Towards the programming of the Sunshine Boulevard

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.