Saturday, 17 August 2013

How to return to same place in for loop with multiple windows in Cocoa

How to return to same place in for loop with multiple windows in Cocoa

I have a for loop editing an array of model objects, some of which require
user input and some of which do not. I would like to be able to open a
second window as needed to display multiple choices to the user, receive
the user's selection, close the second window, and then return to the
place I was in the original loop. In AppleScript, this could be done
simply with a "choose from list" dialog. But I haven't figured out how to
do it in Cocoa since the NSNotificationCenter architecture requires me to
process the second window's response in a different selector. Thus the
loop is broken and I can't process the rest of the array. I also tried
doing it with delegation to no avail. Are panels and alerts the only way
to do this?

No comments:

Post a Comment