Application:openFiles: separate files by groups
I need that my application detect how many files has been dropped to it dock ic开发者_开发问答on. For this i use application:openFiles: method
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
NSLog(@"%d",[filenames count]);
}
But unfortunately files sometimes separates by group. So, for example i dragged 3 files to dock icon and get this output:
2
1
How could it be?
Unfortunately that's life. If you really need to count the number of files received in a drop to the Dock icon, you need to set up a timer to combine the results received by the call application:openFiles:
within a second (or some appropriate length of time.)
精彩评论