Skip to content

Instantly share code, notes, and snippets.

@98chimp
Last active August 29, 2015 14:17
Show Gist options
  • Save 98chimp/8082ece9c41c8c70ef27 to your computer and use it in GitHub Desktop.
Save 98chimp/8082ece9c41c8c70ef27 to your computer and use it in GitHub Desktop.

Revisions

  1. 98chimp revised this gist Mar 20, 2015. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Answer to Questions
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,8 @@
    Q1.
    Q1.A.
    Q1.B. i) Any number of objects may receive the notification, not just the delegate object. This precludes returning a value.
    ii) An object may receive any message you like from the notification center, not just the predefined delegate methods.
    iii) The object posting the notification does not even have to know the observer exists.
    Q1.C.

    Q2. This code will maintain a strong reference to self which leads to a strong reference cycle and poor memory management. To avoid this problem, the code can be modified as follows:
    [self setMySexyBlock:^{ [__weak self mySexyMethod]; }];
  2. 98chimp created this gist Mar 20, 2015.
    6 changes: 6 additions & 0 deletions Answer to Questions
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    Q1.

    Q2. This code will maintain a strong reference to self which leads to a strong reference cycle and poor memory management. To avoid this problem, the code can be modified as follows:
    [self setMySexyBlock:^{ [__weak self mySexyMethod]; }];

    Q3.