iOS work notes (11)

Source: Internet
Author: User

1. About Code Specifications

If you want to use lazy loading,

// Lazy Loading -(Cadisplaylink *) displaylink{    if (!  _displaylink) {        = [cadisplaylink displaylinkwithtarget:self selector: @selector (tododrawline)];         3 ;    }     return _displaylink;}

When declaring a property, you need to use a form similar to the following

@property (Nonatomic,strong) Cadisplaylink *displaylink;

and cannot be written

@interface Barview () {    *_displaylink;}

If written in an underlined form, the lazy loading method is not performed. Must be written in self form
It can be defined as an underscore only when lazy loading is not required.

Rounding of a 2.float or double type, without additional methods, can be handled with the stringWithFormat of the string. Such as:

NSLog (@"%@", [NSString stringWithFormat:@"%.0f",1.0003]); NSLog (@"%@", [NSString stringWithFormat:@"%.0f",1.9003]); NSLog (@"%@", [NSString stringWithFormat:@"%.0f",1.5003]); NSLog (@"%@", [NSString stringWithFormat:@"%.0f",1.4003]);

Printing results:

3. In order to prevent the button to repeat the click, it can be set to a few seconds cannot be clicked. Use

Performselector: @selector () Withobject:afterdelay:

On the line.

iOS work notes (11)

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.