- (IBAction)askUserForImage:(id)sender {
NSOpenPanel* panel = [NSOpenPanel openPanel];
// Let the user select any images supported by
// the NSImage class.
NSArray* imageTypes = [NSImage imageTypes];
[panel setAllowedFileTypes:imageTypes];
[panel beginWithCompletionHandler:^(NSInteger result){
if (result == NSFileHandlingPanelOKButton) {
// Open the image.
}
}]; }
Filters Limit the File Types That the User Can Select
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.