
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 0.66 KB | hits: 13 | expires: Never
Possible to pass [self anyFunction] in blocks without __weak object (iOS 5 ARC)
[UIView animateWithDuration:0.8 animations:^{
//Do animationStuff
} completion:^(BOOL finished) {
[self anyFunction];
}];
__weak MyClass *weakSelf = self;
[weakSelf anyFunction];
[object performBlock:^{
[object performSomeAction]; // Will raise a warning
}];
[self performBlock:^{
[self doSomething]; // Will raise a warning
}];
[self performBlock:^{
[object doSomething]; // <-- No problem here
}];
__block __typeof__(self) bself = self;
[someObject doThingWithBlock:^(id result){
bself.thingWhich = result;
}];