KVO and KVC Finishing materials

Source: Internet
Author: User

Kvc/kvo??????????????????

???? Section Wangzz???????? Section http://blog.csdn.net/wzzvictory/article/details/9674431?????????????? ???????????????????? To increase????????????????????????? Hand?? Wangzzstrive?? ?????? Increase???? such as

???? 1th???????????? You kvc/kvo?????? Increase???????????? See???????????? Really with???? ??? Line 2?????? KVO???????? Increase?? Right???? KVC???????????? Increase?????????????? KVC?? ??? Yes

????????

Kvc/kvo?? The middle species?? Open it?????????? Increase?? Cocoa?????????????? Micro NSObject?? ?????? Nskeyvaluecoding/nskeyvalueobserving???? Just like?????? Just???????? ????????????????? Yes?? Sample???????????? Add Kvc/kvo?????????????????????? ???? Main??????????????? Yes???? Add Kvc/kvo???????????? Objective-c????? Big???? Runtime increased???????????? ???????????? Just the right heart? Add Kvc/kvo??????????? and?? Home?????????? Increase???????????????? Learn?

1?? KVC????
?????? Key-value coding increase?? All?? The?????. Yes???????? Increase?? When?????????? Map

?????? ??????????????????? by live? Force??????? and?? Home??????? and???????????? Two??????????? Yes

2?? KVO????
?????? Key-value observing increase?? All?? ?????????????????????????? of the species in the acquisition

and???????????????????????????. Yes?? Mvc?????????? Cocoa?? Add Kvo??????

? Since?????? Model?? Controller????????????? Yes

???? KVC????????

1?? Key?? Key Path

KVC????????????????? and???????????????? Increase????????? and?????????????? Section [Java] View plaincopy

1. #$ (ID) Valueforkey: (nsstring$*) key;$$
2. #$ (void) SetValue: (ID) Value$forkey: (nsstring$*) key;$$
3. #$ (ID) Valueforkeypath: (nsstring$*) keypath;$$
4. #$ (void) SetValue: (ID) Value$forkeypath: (nsstring$*) keypath;$$

?????????????????? Key?????????? Increase??????? and????????????????????? Research TelePresence??????????????????. KeyPath?????????? To give??? Force action????????? and???????? In??????????? Research TelePresence Love??? Yes???? KeyPath Address.street????? and?? Is??????????????? No?? Address????????? No?????? Street????? Yes???? KeyPath???????????????????????? To give??? and?? When????????????????? People????????? Yes, research telepresence?

2?????????? KVC

????????? and?? Home?????????? Increase?????? To???? KVC? and?????????????????? Increase????????????????? Yes????????? and?????????????? Increase?? To?????????? Increase???? KVC??????????? Ming?????????????????????? Section KVC????? and?????? What's the line?? 3?????????????? To-many?????????????????????????????????????????????????????????? Ming To-one??,???? Person?????? Name???? Increase??????????????????? Yes?????????????????? Increase???? Person???????? Friendsname???? Increase??????? Son?? Ming?? Objective-c???????? Nsarray increased Nsset???? Increase?? Said??????????????????????????? Yes?? To give???????????????????????? Increase?????????????? The

?????? To give??

Yes???? KVC????????? Child?????? Increase????????? Child?????? To give??? Child??????????? Yes

?????? To give??

???????????????????????? Development of increased?????????? After????? I'll??????????????????.
? and??? Child?????????????? No??? Yes

?? The?????????????? of love? The

[Java] View plaincopy

  1. #countOf <key>$$

  2. //???????????????? Nsarray?????????? count:$$

  3. #objectIn <key>atindex:$$

  4. #<key>atindexes:$$

  5. //?????????????????????????? $NSArray $????

    ?? $objectAtIndex: $?? $objectsAtIndexes: $$

  6. #get <key>:range:$$

  7. //?????????????????????????????????????????????? $NSArray $?? ?? $getObjects: range:$$

  8. $$

  9. #insertObject: in<key>atindex:$$

  10. #insert <key>:atindexes:$$

  11. //???????????????????????? $NSMutableArray $????

    ?? $insertObject: atindex:$?? $insertObjects: atindexes:$$

  12. #removeObjectFrom <key>atindex:$$

  13. #remove <key>atindexes:$$

  14. //???????????????????????? $NSMutableArray $????

    ?? $removeObjectAtIndex: $?? $removeObjectsAtIndexes: $$

  15. #replaceObjectIn <key>atindex:withobject:$$

  16. #replace <key>atindexes:with<key>:$$

  17. //???????????????????????????????????????????????????? $$

?? The?????????????? of love? The

[Java] View plaincopy

    1. #countOf <key>$$

    2. //???????????????? Nsarray?????????? count:$$

    3. #objectIn <key>atindex:$$

    4. #<key>atindexes:$$

    5. //?????????????????????????? $NSArray $????

      ?? $objectAtIndex: $?? $objectsAtIndexes: $$

    6. #get <key>:range:$$

    1. //?????????????????????????????????????????????? $NSArray $?? ?? $getObjects: range:$$

    2. $$

    3. #insertObject: in<key>atindex:$$

    4. # insert<key>:atindexes:$$

    5. //???????????????????????? $NSMutableArray $????

      ?? $insertObject: atindex:$?? $insertObjects: atindexes:$$

    6. #removeObjectFrom <key>atindex:$$

    7. #remove < key>atindexes:$$

    8. //???????????????????????? $NSMutableArray $????

      ?? $removeObjectAtIndex: $?? $removeObjectsAtIndexes: $$

    9. #replaceObjectIn <key>atindex:withobject:$$

    10. # replace<key>atindexes:with<key>:$$

    11. //??????????????????????????????????????????????????????? ??????? $$

?????????????????????????? Increase?????????????????????????? Increase???????????? ??? Increase????????????????? with all Do you have a good line? In?????? Increase???? Friends?????????????????????? A?????? Just like?????? Just???? Increase???????????? In my??????????? Line 4???????????? Key-value Validation?? KVC?????? You guys? Key?????? Value?????????????? The

[Java] View plaincopy
1. #$ (BOOL) Validatevalue: (inout$id$*) Iovalue$forkey:

     (nsstring$*) Inkey$error: (out$nserror$**) outerror;$$
?????? Is??????????????????????? I'll??????. The

[Java] View plaincopy
1. #$ (BOOL) validate<key>:error:$$

???????? Name???????????? Section [Java] View plaincopy

    1. # (BOOL) Validatename: (id$*) Iovalue$error: (nserror$*$__autoreleasing$*) outerror${$$

    2. $$$$//$Implementation $specific$code.$$

    3. $$$ $return $ ...; $$

    4. }$$

?????????????????? Then????????? Yes

???? In?????? Add KVC?????????????? they????????. Increase?????????????????? Children

??? Yes???????? To increase???? CoreData??????????? Yes

5?? KVC??????????????????????????

???????????????????? Have to???? Such as???????? To increase the???????????????????????? Time.

???????? KVC????????????????????????????? Line KVC?????????????? Have to???? Such as

???????? The???????????? NSNumber?? Nsvalue???? Increase??????? Self -???? No??? Yes

???? Two?? Add Person???????? Nsinteger?????? Age????

?? Still have to

???????? The KVC really?????????? Just want to?? Age?????? First [Java] view plaincopy

1. [Person$setvalue:[nsnumberwithinteger:5] $forKey: @ "Age"];$$

???????? Age???????? NSNumber???? Add KVC?????????? NSNumber?????? Also?? Nsinteger???? Increase????????????????? and?? Home???? Think?? Age?? Yes, I can.

?????? Have to???? Increase???????? Just???? Age???? Have the first

[Java] View plaincopy
1. [person$valueforkey:@ "Age"];$$

???? Increase???? NSNumber???? Just???? Age?? Yes, I can.

???????????? Increase???????????????? NSNumber Increase???????????????? Nsvalue Yi

Room???? NSNumber????

???????? NSNumber???? The?????? Section [Java] View plaincopy

  1. +$ (nsnumber$*) Numberwithchar: (char) value;$$

  2. +$ (nsnumber$*) Numberwithunsignedchar: (Unsigned$char) value;$$

  3. +$ (nsnumber$*) Numberwithshort: (short) value;$$

  4. +$ (nsnumber$*) Numberwithunsignedshort: (unsigned$short) value;$$

  5. +$ (nsnumber$*) Numberwithint: (int) value;$$

  6. +$ (nsnumber$*) Numberwithunsignedint: (unsigned$int) value;$$

  7. +$ (nsnumber$*) Numberwithlong: (Long) value;$$

  8. +$ (nsnumber$*) Numberwithunsignedlong: (Unsigned$long) value;$$

  9. +$ (nsnumber$*) Numberwithlonglong: (Long$long) value;$$

  10. +$ (nsnumber$*) Numberwithunsignedlonglong: (Unsigned$long$long) value;$$

  11. +$ (nsnumber$*) Numberwithfloat: (float) value;$$

  12. +$ (nsnumber$*) numberwithdouble: (double) value;$$

  13. +$ (nsnumber$*) Numberwithbool: (BOOL) value;$$

  14. +$ (nsnumber$*) Numberwithinteger:

         (Nsinteger) value$ns_available (10_5,$2_0); $$
  15. +$ (nsnumber$*) Numberwithunsignedinteger:

         (Nsuinteger) value$ns_available (10_5,$2_0); $$

???????????????????? Have to???? On the line?????? Nsvalue????

Nsvalue?????????????? Such as???????? To increase the????????????????? Child???? Such as?????? Section [Java] View plaincopy

    1. +$ (nsvalue$*) Valuewithcgpoint: (cgpoint) point;$$

    2. +$ (nsvalue$*) Valuewithcgsize: (cgsize) size;$$

    3. +$ (nsvalue$*) Valuewithcgrect: (CGRect) rect;$$

    4. +$ (nsvalue$*) Valuewithcgaffinetransform:

           (Cgaffinetransform) transform;$$
    5. +$ (nsvalue$*) Valuewithuiedgeinsets: (uiedgeinsets) insets;$$

    6. +$ (nsvalue$*) Valuewithuioffset:

           (Uioffset) Insets$ns_available_ios (5_0); $$

?????????? 6?????? and other???????????????????? Such as?????? Knowing?????? Increase?????? Such as???????????????? Nsvalue?????? Increase???????????? The???????????? To???? Section http://blog.csdn.net/wzzvictory/article/details/8614433 6?????????????? Collection Operators??

? Child??????? Force???????? Be?? Key Path increased???????? The???? Fruit?? Valueforkeypath First???? Increase?????????????????? Increase?????????? Valueforkey:???????????? Line????? Force [email protected]???????? Be??? Research telepresence???????? to the first

?? ???? Child??????? Force

???? Child??????? Force [email protected] increase @count increase @max increase @min increase @sum5?? Increase???? To??

???????????? Increase not????????????????? Yes

??????? Child?????????? Transactions increase?? Said???????????? Transaction??????

Two increases?????????????? Payee Increase amount date? line?????????? Two??????????????

??????? Force first

?????? Amount???? What???????? Section [Java] View plaincopy

1. nsnumber$*transactionaverage$=$[transactions$valueforkeypath:@ "@avg. Amount"];$$

?????? Transactions son?????????? No???????? Section [Java] View plaincopy

1. nsnumber$*numberoftransactions$=$[transactions$valueforkeypath:@ "@c ount"];$$

???????????? Add @count??????? Child??????? Force???????? Be?????? Increase????????????

???? Increase??????????????? Yes

??????????? Force

??? Child??????? Force???? can dot increase?????? And???? Just???? In???????? Increase?????????? The

[Java] View plaincopy
1. @distinctUnionOfObjects $$

2. @unionOfObjects $$?????????? Have to???? Nsarray Added new?????????????????????? Three???? Increase??????????

??????? Wen??????????????????? Son of a line???????? The

[Java] View plaincopy

1. nsarray$*payees$=$[transactions$valueforkeypath:@ "@distinctUnionOfO bjects.payee"];$$

2. nsarray$*payees$=$[transactions$valueforkeypath:@ "@unionOfObjects. P Ayee"];$$

?????????? Good???? Machine???????? Yes?????????? Increase?????????????????? Good???? Machine??? Yes
Between arrays?? Set to??? Force?????????? Can you point?? Increase??????? Child??????? No Child???????? Increase???? Is???????????? On???? The

[Java] View plaincopy

1.//$Create $the$array$that$contains$additional$arrays.$$2. Self.arrayoftransactionsarray$=$[nsmutablearray$array];$$3. $$$
4.//$ADD $the$array$of$objects$used$in$the$above$examples.$$5. [arrayoftransactionsarray$addobject:transactions];$$
6. $$$

    1. $Add $a$second$array$of$objects; $this $array$contains$alternate$values.$$

    2. [arrayoftransactionsarrays$addobject:moretransactions];$$

????????????? No Child????? Son?? Section Arrayoftransactionsarray?????????????? To give?? Arrayoftransactionsarray????? No??? Child???????????? Increase??

??????????????????? Force first

[Java] View plaincopy

1. @distinctUnionOfArrays $$2. @unionOfArrays $$
3. @distinctUnionOfSets $$

????????????? Child???? Arrays Increase????????????? Child???? Sets????. Sets???????????????? Three???? Add [email protected]????? The line of force?

???????????? Two???? The

[Java] View plaincopy
1. nsarray$*payees$=$[arrayoftransactionsarrays$valueforkeypath:@ "@uni

Onofarrays.payee "];$$????????????

1?? KVC?????????????? KVC?? When??????????????? and?? Home??????????? Yes????? and?? Home???????????????????? Increase?????????????????? Increase KVC?? For????? and?? Home?????? To the health???????. Yes???? Think?????????????????? Increase KVC?? Out of love???????? What's the first? Do this???? Said?? -<key>?? -is<key> Ming?????????? Have to?????????? -get<key>??? and?? Home???? Increase?????????? Increase?????????????????? To do this???? Said?????? -set<key>:?????? Increase?????????? Think?? Yes,????. -get<key>?? -set<key>:???? Increase????? Person Key??? Force???????????? Increase???? Cocoa???????????????? , huh? Wen???????? Only?????????? Increase?? Do this???? -_<key>?? -_is<key> Ming?????????? Have to???????? -_get<key>?? -_set<key>:????? ????????????? of the text room and?? Home???? Increase????????????? and???? Two????? Yes?? Two?????????????? Section <key>?? _<key>;?????????????? Increase?????? Valueforundefinedkey:?? Setvalue:forundefinedkey:????? Yes?????????? Is?????????????????? Increase?????????? The??????? People????? Line 2?? KVC/KVO???????? The??????. ???? In the acquisition of The isa-swizzling really???????? Increase?????? The runtime????????? Big????? Yes???????? On???? Yes?????????? To???? Section http://blog.csdn.net/kesalin/article/details/8194240?? When?????????????????? The middle species?? Increase??????????????????? Big???????????????? Know???? Increase?????? Know????????? People???????????? Medium-species?????? Setter????? Do you know???????????? People?? Setter?????????????????????? Increase???????????????? ????? In the acquisition of Yes???????????? Think???????????? Setter???? Increase????????? People???????? KVO??????????????? Yes???????????????? Master per KVO?????? Think???? Just?????????? To increase???? That?????? and??????????????????. Increase?????????? KVO??? Yes???? Know????????? People?? Class?????? "?? More "?????????????????? to????????? Yes???????????????????? Isa in?? In???????? Just???? Know???? Increase??????????????????

?? Know???????????? Increase???????????????? Setter????????????????? People?? Setter increased???? Didn't?? The?????????. Yes???? Know????????? People?? Dealloc?????? Learn?? Look at the micro-line????? People?????? Increase???????? Learn???? Two?? Increase??????????????? Yes???????????? To???? Objective-c?????????????? Section http://blog.csdn.net/wzzvictory/article/details/8592492???????? Increase Isa in?? In?????????????????? Increase???????????????? The person increased?????? Runtime?? of???????????????? Section Nskvonotifying_person???? Nskvonotifying_person??????? People???????? The?????????????????????? Set???? Increase class increase dealloc increase _iskvoa?

?? Class

??? Person Class??????????????????????????????????? People under??????????????????? Yes

?? Road???????? The

[Java] View plaincopy
1. NSLog (@ "self#>isa:%@", Self#>isa); $$

2. NSLog (@ "self$class:%@", [Self$class]); $$?????? KVO?????? Increase?? Road?????? The

[Java] View plaincopy
1. self#>isa:person$$

2. self$class:person$$?????? KVO???????? Increase?? Road?????? The

[Java] View plaincopy
1. self#>isa:nskvonotifying_person$$

2. self$class:person$$?????? ISA in???? Class?????????? New?? Increase??????????????????? Yes

????? Man set????????????? People?????? Set???? Increase???????? Set??????????? Heart???????????????? The

[Java] View plaincopy
1. #$ (void) Willchangevalueforkey: (nsstring$*) key$$

2. #$ (void) Didchangevalueforkey: (nsstring$*) key$$???? Add Didchangevalueforkey:?????? Beauty???? The

[Java] View plaincopy

1. #$ (void) Observevalueforkeypath: (nsstring$*) keypath$$2. $$$$$$$$$$$$$$$$$$$$$ $ofObject:(ID) object$$
3. $$$$$$$$$$$$$$$$$$$$$$$ $change:(nsdictionary$*) change$$4. $$$$$$$$$$$$$$$$$$$$$$ $context:(void$*) context$$

???? Increase?????? KVO???????????? and other??????????????? and?? Home???? Add-setvalue:forkey?????????????? The

[Java] View plaincopy
1. #$ (void) Willchangevalueforkey: (nsstring$*) key$$

2. #$ (void) Didchangevalueforkey: (nsstring$*) key$$?????????????? The????. Right????????? Self -????????? and?????????????? Increase????????

?? Up to?????? Only???????? Increase???????????? Kvo and other???????? Increase?????? KVO?????????? 1th)?????? KVC

?????? KVC Increase??????? and?? Home???? Increase????????????? and?? Home?????????? Will/didchangevalueforkey:????? Wen????? and?? Home???? Increase?????????? Setvalue:forkey?????????? Will/didchangevalueforkey:????? Yes

2)??? and?? Home??????????????? People, and?? Home???????? Will/didchangevalueforkey:????? Yes???? Increase????????? and?? Home???? of?????? Got to?? Add KVO??????????? Line 3) to???? Will/didchangevalueforkey:????? Yes???? Increase?????? KVO Increase?????? Will/didchangevalueforkey:????????????? Interbank _iskvoa
???????????? Back???????? You have to?????????? KVO????????????? Yes??????????????
1??????
?????????????????? ???????
Two?????????? Increase??????????
?????? Points?? To?????????????????? Live Increase?????? AppleScript?? Points?? To?? Increase?????????? Over????????????? Line 2??????
KVC?????????? Increase?????? KVO?? Increase???????? The???? To???? Section http://www.mikeash.com/pyblog/key-value-observing-done-right.html???????????? KVO?????????? Increase?????????? Selector???? Block???????? Increase???? Let??? Person-addobserver:forkeypath:options:context:?????? Yes??????????????? Yes???????????????? Increase???????????????????? Makvonotificationcenter?? Increase?????? GitHub
Https://github.com/mikeash/MAKVONotificationCenter?????????????????????????? KVO?? Many???? Increase?????????? Letter Line

The?????? The

http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/keyvaluecoding/articles/ Keyvaluecoding.html#//apple_ref/doc/uid/10000107-sw1
http://blog.csdn.net/kesalin/article/details/8194240

KVO and KVC Finishing materials

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.