5
이것은 열린 패널을 부동 창으로 표시하는 방법입니다.NSOpenPanel 시트
패널을 시트로 사용하여 나를 도울 수있는 사람이 있습니까? 창 개체는 mWindow입니다. 내가 사용했던 표준 코드의 상당 부분은 절하되었다.
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
NSArray* fileTypes = [[NSArray alloc] initWithObjects:@"mp3", @"mp2", @"m4a", nil];
[openPanel setAllowsMultipleSelection: NO];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanCreateDirectories:NO];
[openPanel setCanChooseFiles:YES];
[openPanel setAllowedFileTypes:fileTypes];
NSString * filePath = @"~/Desktop";
filePath = [filePath stringByExpandingTildeInPath];
NSURL *fileURL = [NSURL fileURLWithPath:filePath];
[openPanel setDirectoryURL:fileURL];
NSInteger clicked = [openPanel runModal];
if (clicked == NSFileHandlingPanelOKButton) {
for (NSURL *url in [openPanel URLs]) {
NSString *urlString = [url path];
[input setStringValue:urlString];
NSString *myString = [input stringValue];
NSString *oldPath = [myString lastPathComponent];
[inputDisplay setStringValue:oldPath];
}
}
감사합니다 - 여전히 그것을 얻을 수 없습니다. 구문 분석 오류가 발생합니다. – user1198008
어떤 오류가 발생했는지 설명하십시오. –
죄송합니다. 나는 단순히 다른 것을 생략하고 있었다. * after *]; 이제 잘 작동합니다. 도와 주셔서 감사합니다. – user1198008