iphone - How do I implement "Cancel" button inside the method building data source in ModelController.m for Page View Controller -
i have page view controller that's implemented in 3 files. 1 of them, modelcontroller.m implements "generatedata" method, builds , formats pages page view controller. inside method, first thing create progress bar popup "cancel" button. then, inside while() loop, keep building pages , @ same time, every 10th page, update progress bar user see application still generating output. once "generatedata" method completes, i.e. builds pages (and there may on 1,000 or 10,000 pages depending on user input), returns "self" method inside rootviewcontroller.m, in turn passes generated data in "dataobject" "viewwillappear" in dataviewcontroller.m, displays pages in object user. it works great, except "cancel" button. because "generatedata" method runs on main thread, blocks , "cancel" button becomes totally unresponsive. "blocks" of course mean takes cpu cycles, not allowing anyting