Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.66 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Possible to pass [self anyFunction] in blocks without __weak object (iOS 5   ARC)
  2. [UIView animateWithDuration:0.8 animations:^{
  3.             //Do animationStuff
  4.         } completion:^(BOOL finished) {
  5.             [self anyFunction];
  6.  }];
  7.        
  8. __weak MyClass *weakSelf = self;
  9.        
  10. [weakSelf anyFunction];
  11.        
  12. [object performBlock:^{
  13.     [object performSomeAction]; // Will raise a warning
  14. }];
  15.        
  16. [self performBlock:^{
  17.     [self doSomething];    // Will raise a warning
  18. }];
  19.        
  20. [self performBlock:^{
  21.     [object doSomething];    // <-- No problem here
  22. }];
  23.        
  24. __block __typeof__(self) bself = self;
  25. [someObject doThingWithBlock:^(id result){
  26.     bself.thingWhich = result;
  27. }];