You can use main thread notification queue with NSPostWhenIdle
style notifications (https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/Notifications/Articles/NotificationQueues.html#//apple_ref/doc/uid/20000217-115535) to start the background task.
The background task can be done by starting NSOperation
on NSOperationQueue
. NSOperation
supports cancellation, your background task will need to check isCancelled
flag periodically. If user resumes sliding while the background task is in progress you will need to cancel the task and post NSPostWhenIdle
notifications again.