iOS intermediate--when to define attributes using the Copy,strong,weak,assign keyword

Source: Internet
Author: User
<span id="Label3"></p>? The parent class pointer can point to a subclass Object?//define the block Alias. typedef void (^lyitemoption) ();<br> <br>@interface Lyitemarrow:lyitem<br>@property (nonatomic,strong) Class descontroller; @property (nonatomic,copy) lyitemoption option;?? 1.strong: OC Object except nsstring\block? @property (nonatomic,strong) nsarray? *< #model #>;<span style="font-family: Menlo;"><span style="font-family: Menlo;">2.weak: Various UI controls (but not absolute, There are controls to use the strong Property)</span></span>? [email protected] (nonatomic,weak) UIButton *button;<span style="font-family: Menlo;"><span style="font-family: Menlo;">3.assign:cgfloat,nsinteger, etc.</span></span>Basic data types, enumerations, struct bodies (non-oc objects)? [email protected] (nonatomic,assign) CGFloat < #model #>;4.copy:????? Copy: An immutable copy is created (such as nsstring, nsarray, nsdictionary)????? Mutablecopy: are you creating a mutable copy (such as nsmutablestring, nsmutablearray, nsmutabledictionary)? @property (nonatomic,copy) nsstring *< #model #>; [email protected] The choice of memory management policy? 1. non-arc? 1> copy: only for nsstring\block? 2> retain: oc Object except nsstring\block? 3> assign: Basic Data type, enumeration, struct (NON-OC object), when 2 objects reference each other, one end with retain, one end with assign?2.arc? 1> copy: only for nsstring\block? 2> strong: oc Object except nsstring\block? 3> Weak: when 2 objects are referenced to each other, one end with strong and one end with weak? 4> assgin: Basic Data type, enumeration, struct body (non-oc Object)<p><p>iOS intermediate--when to define attributes using the Copy,strong,weak,assign keyword</p></p></span>

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.