Object-oriented 1

Source: Internet
Author: User

Key-Value code (KVC) key-value listener (KVO)

SetValue: Attribute value Forkey: Property name does not find corresponding member variable will burst exception (first method-member variable-member variable of name within Class) _ Member variable name

Valueforkey: Property name does not find the corresponding member variable will burst exception (first method-member variable-member variable of name within Class)

Method name underscore member variable member variable

Resolving exception Methods overriding Setvalue:forundefinedkey: Methods and Valueforundefinedkey: Methods

Handling nil Value Rewrite Setnilvalueforkey: Method

Processing compound type with key path Forkeypath:valueforkeypath:

Actually, it's better than performance. The KVC operation has good performance without getter and setter methods. Just KVC simple operation. It can refine the universal code.

KVO (key value observing) key-value monitoring

Registration method AddObserver:forKeyPath:option:context;

Delete method: Removerobserver:forkeypath and RemoverObserver:forKeyPath:context:

ObserValueForKeyPath:ofObject:change:context is called: you need to override the modification method to change the state when used for callbacks.

Object-oriented 1

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.