Hello all, I have run into a situation that I don't quite have a solution for. I have a UIScrollView that holds a bunch of CALayers. My controller is set up to check and see if it can cache layers that are offscreen after the user scrolls a certain amount. I found that doing this on the main thread was causing my scrolling to not be very smooth so I decided to use NSInvocationOperations to figure out what can be cached in an operation queue.
Everything is working fine but I am not sure how I deal with canceling the operation. If I were subclassing NSOperation I would simply check to see if [self isCancelled] returned true and go from there but if I throw this into my method that I am passing to the NSInvocationOperation I will just be calling this on my controller object. I guess the root of my question is how do I access the operation from within my method that I am passing to initWithTarget:selector:object when I create my invocation operation? I guess I could just create a subclass of NSOperation but I would like to avoid this because I think it would be overkill. --------------------------- // Some Code: - (void)myOperationInController; { // Do stuff if (![self isCancelled]) // <---- I need to access the operation here, self refers to my controller [self performSelectorOnMainThread...] } - (void)scrollViewDidScroll:(UIScrollView *)scrollView { // Note: I am not creating an operation every time the user scrolls in my actual application NSInvocationOperation *op = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(myOperationInController) object:nil]; [self.oprationQueue addOperation:op]; [op release]; } --------------------------- Thanks in advance, Chase _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com