- (voID) application:(NSApplication*)sender openfiles:(NSArray*)filenames{ // I saw cases in which dragging a bunch of files onto the app // actually called application:openfiles several times,resulting // in more than one window,with the dragged files split amongst them. // This is lame. So we queue them up and open them all at once later. [self queuefilesForopening:filenames]; [NSApp replyToOpenorPrint:NSApplicationDelegateReplySuccess];}- (voID) queuefilesForopening:(NSArray*)filenames{ [self.filesToOpen addobjectsFromArray:filenames]; [self performSelector:@selector(openQueuedfiles) withObject:nil afterDelay:0.25];}- (voID) openQueuedfiles{ if( self.filesToOpen.count == 0 ) return; [self makeNewWindowWithfiles:self.filesToOpen]; [self.filesToOpen removeAllObjects];}总结
以上是内存溢出为你收集整理的objective-c – 为什么NSApplicationDelegate方法openFiles:多次拖动到停靠图标时被多次调用?全部内容,希望文章能够帮你解决objective-c – 为什么NSApplicationDelegate方法openFiles:多次拖动到停靠图标时被多次调用?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)