andreamazz / SlideOutNavigation

SlideOut Navigation Controller for iOS.
MIT License
210 stars 49 forks source link

addViewController...:beforeChange:onCompletition: #85

Closed chrux closed 9 years ago

chrux commented 9 years ago

Hi Guys,

Do you think it wont be wonderful to have the AMSlideOutNavigationController being pass to the block too? I have a situation in which I need to make use of the class and hide/show the navigation bar but when I use the variable declared outside the block I received this warning "Capturing [an object] strongly in this block is likely to lead to a retain cycle"

Any thoughts, ideas?

If you feel like it would be good I can implement it and send the pull request.

Best

andreamazz commented 9 years ago

Hi @chrux No need to add the object to the completion block, you just need to use a weak reference inside the block. It's a common pattern in objective C, something like that:

__weak AppDelegate *weakSelf = self;
[self.slideOut doSomethingOnCompletion:^{
    [weakSelf.slideOut doSomethingElse];
}];
chrux commented 9 years ago

Ok, got it, thanks.