开发者

Application:openFiles: separate files by groups

开发者 https://www.devze.com 2023-01-15 00:23 出处:网络
I need that my application detect how many files has been dropped to it dock ic开发者_开发问答on. For this i use application:openFiles: method

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.)

0

精彩评论

暂无评论...
验证码 换一张
取 消