去掉顶部titlebar
guard let windowScene = (scene as? UIWindowScene) else { return } #if targetEnvironment(macCatalyst) if let titlebar = windowScene.titlebar { titlebar.titleVisibility = .hidden titlebar.toolbar = nil } #endif
禁止休眠
CFStringRef reasonForActivity= CFSTR("Describe Activity Type"); IOPMAssertionID assertionID; IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
读取本地图片
NSArray *documentTypes = @[@"public.image"]; UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:documentTypes inMode:UIDocumentPickerModeOpen]; documentPicker.delegate = self; documentPicker.modalPresentationStyle = UIModalPresentationFullScreen; [self presentViewController:documentPicker animated:YES completion:nil];
闲着没事,尝试一下Mac开发
资料比较难找,所以记录一下