系统NSNotification的Name列表

系统NSNotification的Name列表

键入属性
AVAudioEngineConfigurationChangeNotification  
当音频引擎配置发生变化时。

AVAudioSessionInterruptionNotification  
发生音频中断发生。

AVAudioSessionMediaServicesWereLostNotification  
当媒体服务器终止时发布。

AVAudioSessionMediaServicesWereResetNotification  
当媒体服务器重新启动时发布。

AVAudioSessionRouteChangeNotification 当系统的音频路由发生变化时发布。 AVAudioSessionSilenceSecondaryAudioHintNotification 当其他应用程序的主音频启动和停止时发布。 AVAudioUnitComponentTagsDidChangeNotification 组件标签已更改。 CKAccountChangedNotification 登录iCloud帐户的状态可能已更改时发出的通知。 CLKComplicationServerActiveComplicationsDidChangeNotification 发表了一系列积极的并发症变化。 CNContactStoreDidChangeNotification 当另一个CNContactStore发生更改时发布的通知。 EKEventStoreChangedNotification 每当对Calendar数据库进行更改时,都会发布,包括添加,删除和更改事件或提醒。没有描述个人更改。当您收到此通知后,你应该重新获取所有EKEvent与EKReminder您访问,因为它们被认为是过时的对象。如果您正在积极地编辑一个事件,并且不想重新读取它,除非绝对有必要这样做,否则可以调用该refresh方法。如果该方法返回YES,则不需要重新获取该事件。 HKUserPreferencesDidChangeNotification 当用户更改他或她的首选单位时通知观察员。 HMCharacteristicPropertySupportsEventNotification 该特性支持使用由控制器建立的事件连接的通知。事件连接提供从附件到控制器的单向通信。 NSBundleResourceRequestLowDiskSpaceNotification 在系统检测到可用磁盘空间量变得越来越小之后发布。通知将发布到默认通知中心。 NSCalendarDayChangedNotification 系统日历,区域设置和时区确定系统日历日后发布。此通知不提供object。 NSDidBecomeSingleThreadedNotification 未实现。 NSExtensionHostDidBecomeActiveNotification 当扩展程序的主机应用程序从非活动状态移动到活动状态时发布。 NSExtensionHostDidEnterBackgroundNotification 当分机的主机应用程序在后台开始运行时发布。 NSExtensionHostWillEnterForegroundNotification 当扩展程序的主机应用程序开始在前台运行时发布。 NSExtensionHostWillResignActiveNotification 当扩展程序的主机应用程序从活动状态移动到非活动状态时发布。 NSFileHandleConnectionAcceptedNotification 当对象在两个进程之间建立一个套接字连接时,会发布此通知,为连接的一端创建一个对象,并通过将该对象放在字典中使其成为观察者。 NSFileHandleNSFileHandleuserInfo NSFileHandleDataAvailableNotification 当文件句柄确定数据当前可用于在文件或通信通道中读取时,会发布此通知。 NSFileHandleReadToEndOfFileCompletionNotification 当文件句柄读取文件中的所有数据时,或者如果通信通道,直到其他进程指示数据结束,则会发布此通知。 NSHTTPCookieManagerAcceptPolicyChangedNotification 当实例的接受策略发生变化时,会发布此通知。NSHTTPCookieStorage NSHTTPCookieManagerCookiesChangedNotification 当实例中存储的Cookie 已更改时,会发布此通知。NSHTTPCookieStorage NSManagedObjectContextDidSaveNotification 每当托管对象上下文完成保存操作时发布。 NSManagedObjectContextObjectsDidChangeNotification 当管理对象上下文中包含的对象的属性值发生变化时发布。 NSManagedObjectContextWillSaveNotification 每当托管对象上下文即将执行保存操作时发布。 NSMetadataQueryDidFinishGatheringNotification 当接收方完成查询的初始结果收集阶段时发布。 NSMetadataQueryDidStartGatheringNotification 当接收者以查询的初始结果收集阶段开始时发布。 NSMetadataQueryDidUpdateNotification 当查询的实时更新阶段接收者的结果发生变化时发布。 NSMetadataQueryGatheringProgressNotification 作为接收者在查询的初始结果收集阶段收集结果时发布。 NSPersistentStoreCoordinatorStoresDidChangeNotification 每当持久性存储被添加到永久存储协调器或从持久存储协调器中删除时,或当存储UUID更改时,都会发布。 NSPersistentStoreCoordinatorStoresWillChangeNotification 发布在开放持久存储库列表之前发生变化。 NSPersistentStoreCoordinatorWillRemoveStoreNotification 每当永久存储协调器中删除持久存储时,都会发布。 NSProcessInfoPowerStateDidChangeNotification 当iOS设备的电源状态(低功耗模式被启用或禁用)发生变化。 NSSystemClockDidChangeNotification 每当系统时钟更改时发布。这可以通过调用settimeofday()或更改“日期和时间首选项”面板中的值来启动。 NSSystemTimeZoneDidChangeNotification 当时区更改时发送。 NSThreadWillExitNotification 一个NSThread对象的帖子当它接收到该通知exit消息,该线程退出之前。调用接收此通知的Observer方法在退出的线程之前执行。 NSURLCredentialStorageChangedNotification 当存储的凭据集更改时,会发布此通知。 NSUbiquityIdentityDidChangeNotification 在iCloud(“无处不在”)身份发生变化之后发送。 NSUndoManagerCheckpointNotification 每当对象打开或关闭撤消组(除了打开顶级组之外)和检查重做堆栈时,都会发布。NSUndoManagercanRedo NSUndoManagerDidCloseUndoGroupNotification 发布后一个对象关闭一个撤消组,这在方法的实现中发生。NSUndoManagerendUndoGrouping NSUndoManagerDidOpenUndoGroupNotification 每当一个对象打开一个撤消组,发生在该方法的实现中。NSUndoManagerbeginUndoGrouping NSUndoManagerDidRedoChangeNotification 在对象执行重做操作()之后发布。NSUndoManagerredo NSUndoManagerDidUndoChangeNotification 在对象执行撤消操作之后发布。NSUndoManager NSUndoManagerWillCloseUndoGroupNotification 在一个对象关闭一个撤消组之前发生,这个方法发生在实现中。NSUndoManagerendUndoGrouping NSUndoManagerWillRedoChangeNotification 在对象执行重做操作()之前发布。NSUndoManagerredo NSUndoManagerWillUndoChangeNotification 在对象执行撤消操作之前发布。NSUndoManager NSWillBecomeMultiThreadedNotification 当第一个线程与当前线程分离时发布。该NSThread课程信息此通知最多一次,第一次一个线程被分离使用或方法。后续调用这些方法不会发布此通知。这个通知的观察者在主线程中调用了它们的通知方法,而不是新线程。观察者通知方法总是在新线程开始执行之前执行。detachNewThreadSelector:toTarget:withObject:start PKPassLibraryDidChangeNotification 发布后通过库已被更改。 PKPassLibraryRemotePaymentPassesDidChangeNotification 当与当前iOS设备(例如Apple Watch)配对的设备添加或删除Apple Pay卡时发布。 UIAccessibilityAnnouncementDidFinishNotification 系统读完通知后,由UIKit发表。 UIAccessibilityElementFocusedNotification WKAudioFilePlayerItemDidPlayToEndTimeNotification 当项目成功播放到其结束时发布。 WKAudioFilePlayerItemFailedToPlayToEndTimeNotification 当项目未能到达结束时发布。 WKAudioFilePlayerItemTimeJumpedNotification 当项目当前时间不连续地更改时发布。 ABPeoplePickerDisplayedPropertyDidChangeNotification 当记录列表中显示的属性更改时发布。 ABPeoplePickerGroupSelectionDidChangeNotification 当组列表中的选择更改时发布。 ABPeoplePickerNameSelectionDidChangeNotification 当名称列表中的选择更改时发布。 ABPeoplePickerValueSelectionDidChangeNotification 当多值属性中的选择更改时发布。 ACAccountStoreDidChangeNotification 当这个帐户存储管理的帐户在数据库中更改时发布。没有与此通知关联的字典。userInfo AVAssetChapterMetadataGroupsDidChangeNotification AVAssetContainsFragmentsDidChangeNotification AVAssetDurationDidChangeNotification AVAssetMediaSelectionGroupsDidChangeNotification AVAssetTrackSegmentsDidChangeNotification AVAssetTrackTimeRangeDidChangeNotification AVAssetTrackTrackAssociationsDidChangeNotification AVAssetWasDefragmentedNotification AVCaptureDeviceWasConnectedNotification 当新设备可用时发布。 AVCaptureDeviceWasDisconnectedNotification 当现有设备不可用时发布。 AVCaptureInputPortFormatDescriptionDidChangeNotification 发布如果捕获输入端口的属性的值发生变化。formatDescription AVCaptureSessionDidStartRunningNotification 当捕获会话开始时发布。 AVCaptureSessionDidStopRunningNotification 当捕获会话停止时发布。 AVCaptureSessionRuntimeErrorNotification 在捕获会话期间发生错误时发布。 AVFragmentedMovieContainsMovieFragmentsDidChangeNotification AVFragmentedMovieDurationDidChangeNotification AVFragmentedMovieTrackSegmentsDidChangeNotification AVFragmentedMovieTrackTimeRangeDidChangeNotification AVFragmentedMovieTrackTotalSampleDataLengthDidChangeNotification AVFragmentedMovieWasDefragmentedNotification AVPlayerItemDidPlayToEndTimeNotification 当项目播放到最后时间时发布。 AVPlayerItemFailedToPlayToEndTimeNotification 当项目未能到达结束时发布。 AVPlayerItemNewAccessLogEntryNotification 当添加新的访问日志条目时发布。 AVPlayerItemNewErrorLogEntryNotification 当添加了新的错误日志条目时发布。 AVPlayerItemPlaybackStalledNotification 发布时有些媒体没有及时到达继续播放。 AVPlayerItemTimeJumpedNotification 当项目当前时间不连续地更改时发布。 AVSampleBufferDisplayLayerFailedToDecodeNotification 当缓冲区显示层解码失败时发布。 CWBSSIDDidChangeNotification CWCountryCodeDidChangeNotification CWLinkDidChangeNotification CWLinkQualityDidChangeNotification CWModeDidChangeNotification CWPowerDidChangeNotification CWSSIDDidChangeNotification CWScanCacheDidUpdateNotification GCControllerDidConnectNotification 在新控制器连接到设备后立即发布。 GCControllerDidDisconnectNotification 在控制器与设备断开连接后立即发布。 IKFilterBrowserFilterDoubleClickNotification 当用户双击过滤器浏览器中的过滤器时发布。 IKFilterBrowserFilterSelectedNotification 当用户在过滤器浏览器中单击过滤器名称时发布。 IKFilterBrowserWillPreviewFilterNotification 在显示过滤器预览之前,发布,允许应用程序设置过滤器的参数。 IOBluetoothHostControllerPoweredOffNotification IOBluetoothHostControllerPoweredOnNotification IOBluetoothL2CAPChannelPublishedNotification IOBluetoothL2CAPChannelTerminatedNotification MKAnnotationCalloutInfoDidChangeNotification 通知观察者注释对象的标题或字幕信息已更改。 NEFilterConfigurationDidChangeNotification 发布后,过滤器配置存储在“网络扩展”首选项中。 NEVPNConfigurationChangeNotification 发布后,VPN配置存储在网络扩展首选项中。 NEVPNStatusDidChangeNotification 当VPN连接状态发生变化时。 NSAccessibilityAnnouncementRequestedNotification 只要可访问性元素需要向用户发布通知,就会发布此通知。此通知需要具有密钥的字典和包含公告的本地化字符串。为了帮助一个辅助应用程序确定公告的重要性,请添加相应的字典。userInfoNSAccessibilityAnnouncementKeyNSAccessibilityPriorityKeyuserInfo NSAccessibilityApplicationActivatedNotification 该通知在应用程序激活后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityApplicationDeactivatedNotification 该通知在应用程序停用后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityApplicationHiddenNotification 该应用程序隐藏后会发布此通知。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityApplicationShownNotification 此通知在应用显示后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityCreatedNotification 此通知在创建可访问性元素后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityDrawerCreatedNotification 此通知在出现抽屉后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityFocusedUIElementChangedNotification 此通知在辅助功能元素获取焦点后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityFocusedWindowChangedNotification 此通知在关键窗口更改后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityHelpTagCreatedNotification 此通知会在出现帮助标签后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityLayoutChangedNotification 此通知会在UI更改后发布,需要引导客户端的注意。此通知应附带一个带有密钥和包含已添加或更改的UI元素的数组的字典。使用函数而不是实例发布此通知。userInfoNSAccessibilityUIElementsKeyNSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityMainWindowChangedNotification 此通知在主窗口更改后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityMovedNotification 此通知在辅助功能元素移动后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityResizedNotification 此通知在辅助功能元素的大小更改后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityRowCollapsedNotification 此通知在一行折叠后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityRowCountChangedNotification 此通知会在添加或删除行后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityRowExpandedNotification 此通知在一行展开后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilitySelectedCellsChangedNotification 在通过选择或取消选择基于单元格的表格中的一个或多个单元格之后,会发布此通知。使用函数而不是实例发布此通知。 NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilitySelectedChildrenChangedNotification 选择或取消选择一个或多个子元素后,会发布此通知。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilitySelectedChildrenMovedNotification 此通知在布局区域中选定的项目移动后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilitySelectedColumnsChangedNotification 此通知在选择或取消选择一个或多个列之后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilitySelectedRowsChangedNotification 此通知在选择或取消选择一行或多行后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilitySelectedTextChangedNotification 此通知是在选择或取消选择文本后发布的。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilitySheetCreatedNotification 此通知会在工作表出现后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityTitleChangedNotification 该通知在辅助功能元素的标题更改后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityUIElementDestroyedNotification 此通知在可见性元素销毁后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityUnitsChangedNotification 该通知在布局区域中的单位更改后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityValueChangedNotification 该通知在可访问性元素的值更改后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityWindowCreatedNotification 此通知会在新窗口出现后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityWindowDeminiaturizedNotification 窗口从Dock恢复到完整大小后,会发布此通知。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityWindowMiniaturizedNotification 这个通知是在窗口放入Dock后发布的。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityWindowMovedNotification 此通知在窗口移动后发布。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAccessibilityWindowResizedNotification 窗口大小更改后会发布此通知。使用函数而不是实例发布此通知。NSAccessibilityPostNotificationNSNotificationCenter NSAnimationProgressMarkNotification 当运行动画的当前进度达到其进度标记之一时发布。 NSAntialiasThresholdChangedNotification 发布在反锯齿变化的阈值之后。 NSAppleEventManagerWillProcessFirstEventNotification 发布之前,它首先发送一个苹果事件。您的应用程序可以使用此通知,以避免在首次需要它们之前注册任何Apple事件处理程序。NSAppleEventManager NSApplicationDidBecomeActiveNotification 应用程式启动后立即发布。 NSApplicationDidChangeOcclusionStateNotification 当应用程序的遮挡状态发生变化时发布。 NSApplicationDidChangeScreenParametersNotification 当连接到计算机的显示器的配置更改时发布。 NSApplicationDidFinishLaunchingNotification 发布在方法的最后,表明应用程序已完成启动并准备运行。finishLaunching NSApplicationDidFinishRestoringWindowsNotification 当应用程序完成恢复窗口时发布。 NSApplicationDidHideNotification 发布在hide:方法的结尾,表示该应用程序现在已被隐藏。 NSApplicationDidResignActiveNotification 应用程序将其活动状态放弃到另一个应用程序后立即发布。 NSApplicationDidUnhideNotification 发布在方法的结尾,表示该应用程序现在可见。unhideWithoutActivation NSApplicationDidUpdateNotification 发布在方法的最后,表明应用程序已经完成了更新其窗口。updateWindows NSApplicationWillBecomeActiveNotification 立即在应用程式启动之前发布。 NSApplicationWillFinishLaunchingNotification 发布在方法的开始,表明应用程序已完成初始化过程,即将完成启动。finishLaunching NSApplicationWillHideNotification 发表在hide:方法的开始,表明应用程序即将被隐藏。 NSApplicationWillResignActiveNotification 在应用程序将其活动状态放弃到另一个应用程序之前立即发布。 NSApplicationWillTerminateNotification 由该terminate:方法发布,表明该应用将终止。 NSApplicationWillUnhideNotification 发布在方法的开始,以表明应用程序即将变得可见。unhideWithoutActivation NSApplicationWillUpdateNotification 发表在方法的开始,表示该应用程序即将更新其窗口。updateWindows NSBrowserColumnConfigurationDidChangeNotification 当浏览器列的宽度已更改时通知代理。 NSClassDescriptionNeededForClassNotification 当一个类不能找到类描述时发布。classDescriptionForClass: NSColorListDidChangeNotification NSColorPanelColorDidChangeNotification 发布时的颜色设置,当被调用时。NSColorPanelNSColorPanel NSComboBoxSelectionDidChangeNotification 发布后弹出列表选择更改。NSComboBox NSComboBoxSelectionIsChangingNotification 发布时,弹出列表的选择正在改变。NSComboBox NSComboBoxWillDismissNotification 当弹出列表即将被驳回时,就会发布。NSComboBox NSComboBoxWillPopUpNotification 每当弹出列表显示时,都会发布。NSComboBox NSContextHelpModeDidActivateNotification 当应用程序进入上下文相关帮助模式时发布。当用户按住帮助键时,通常会发生这种情况。 NSContextHelpModeDidDeactivateNotification 当应用程序退出上下文相关帮助模式时发布。当用户在显示上下文相关帮助主题后,在光标位于屏幕上的任何位置时,用户单击鼠标按钮就会发生。 NSControlTextDidBeginEditingNotification 当具有可编辑单元格的控件开始编辑会话时发送。 NSControlTextDidChangeNotification 发送时接收控件中的文本发生变化。 NSControlTextDidEndEditingNotification 当具有可编辑单元的控件结束编辑会话时发送。 NSControlTintDidChangeNotification 发送后用户更改控件色调偏好。 NSDrawerDidCloseNotification 每当抽屉关闭时发布。 NSDrawerDidOpenNotification 每当抽屉打开时发布。 NSDrawerWillCloseNotification 每当抽屉即将关闭时发布。 NSDrawerWillOpenNotification 随便抽屉即将开放。 NSFontCollectionDidChangeNotification 每当更改字体集合时发布。 NSFontSetChangedNotification 发布在当前设置的字体更改后。 NSImageRepRegistryDidChangeNotification 每当类注册表更改时发布。NSImageRep NSMenuDidAddItemNotification 在菜单项添加菜单后发布。 NSMenuDidBeginTrackingNotification 当菜单跟踪开始时发布。 NSMenuDidChangeItemNotification 发布在菜单中的菜单项后改变外观。 NSMenuDidEndTrackingNotification 当菜单跟踪结束时发布,即使没有发送任何操作。 NSMenuDidRemoveItemNotification 从菜单中删除菜单项后发布。 NSMenuDidSendActionNotification 在应用程序发布之后发布菜单项的动作方法到菜单项的目标。 NSMenuWillSendActionNotification 在应用程序之前发布菜单项的操作方法到菜单项的目标。 NSOutlineViewColumnDidMoveNotification 每当一个列被用户操作移动到对象中时,就会发布。NSOutlineView NSOutlineViewColumnDidResizeNotification 每当一个列在对象中调整大小时发布。NSOutlineView NSOutlineViewItemDidCollapseNotification 每当项目在对象中折叠时发布。NSOutlineView NSOutlineViewItemDidExpandNotification 每当项目在对象中展开时,就会发布。NSOutlineView NSOutlineViewItemWillCollapseNotification 在项目折叠之前发布(用户点击箭头但项目折叠前)。 NSOutlineViewItemWillExpandNotification 在项目展开之前发布(用户点击箭头但项目折叠前)。 NSOutlineViewSelectionDidChangeNotification 在大纲视图的选择更改后发布。 NSOutlineViewSelectionIsChangingNotification 发布为大纲视图的选择更改(当鼠标按钮仍然停止)。 NSPersistentStoreDidImportUbiquitousContentChangesNotification 发布后记录是从无处不在的内容商店导入的。 NSPopUpButtonCellWillPopUpNotification 此通知在弹出菜单附加到其窗口框架之前发布。 NSPopUpButtonWillPopUpNotification 当对象收到鼠标下拉事件时,即用户即将从菜单中选择一个项目时发布。NSPopUpButton NSPopoverDidCloseNotification 在popover已经完成离线动画后发送。 NSPopoverDidShowNotification 在popover已经完成屏幕动画后发送。 NSPopoverWillCloseNotification 在popover关闭之前发送。 NSPopoverWillShowNotification 在popover显示之前发送。 NSPreferredScrollerStyleDidChangeNotification 如果首选的滚动样式更改,则发布。 NSRuleEditorRowsDidChangeNotification 每当视图行更改时,此通知将发布到默认通知中心。 NSScreenColorSpaceDidChangeNotification 当屏幕的颜色空间发生变化时发布。 NSScrollViewDidEndLiveMagnifyNotification 发布在放大手势的结尾。 NSScrollViewDidEndLiveScrollNotification 发表在主线程的末端滚动跟踪。 NSScrollViewDidLiveScrollNotification 由于用户启动的事件更改剪辑视图原点后,发布在主线程上。 NSScrollViewWillStartLiveMagnifyNotification 发表在放大手势的开始。 NSScrollViewWillStartLiveScrollNotification 在用户启动的实时滚动跟踪开始时发布主线程(手势滚动或滚动跟踪,例如,拇指拖动)。 NSSpellCheckerDidChangeAutomaticCapitalizationNotification 

转载于:https://www.cnblogs.com/ruixin-jia/p/7687334.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在移动端应用中,可以通过监听系统的截屏事件来实现对截屏行为的监听。不同平台的实现方式略有不同,下面我将分别介绍Android和iOS平台的监听方法。 对于Android平台,可以通过注册广播接收器来监听截屏事件。首先,在AndroidManifest.xml文件中添加以下权限和声明: ```xml <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application ...> ... <receiver android:name=".ScreenshotReceiver"> <intent-filter> <action android:name="android.intent.action.SCREEN_ON" /> <action android:name="android.intent.action.SCREEN_OFF" /> <action android:name="android.intent.action.USER_PRESENT" /> </intent-filter> </receiver> </application> ``` 然后,创建一个名为ScreenshotReceiver的广播接收器类,并在其中重写`onReceive()`方法: ```java public class ScreenshotReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_SCREEN_ON.equals(action)) { // 屏幕点亮时的逻辑处理 } else if (Intent.ACTION_SCREEN_OFF.equals(action)) { // 屏幕关闭时的逻辑处理 } else if (Intent.ACTION_USER_PRESENT.equals(action)) { // 解锁屏幕时的逻辑处理 } } } ``` 通过在`onReceive()`方法中添加逻辑处理,可以对不同的截屏事件做出相应的响应。 对于iOS平台,可以使用`UIScreen`的`UIScreenDidScreenshotNotification`通知来监听截屏事件。在需要监听的地方,添加以下代码: ```swift NotificationCenter.default.addObserver(self, selector: #selector(handleScreenshot), name: UIScreen.capturedDidChangeNotification, object: nil) @objc func handleScreenshot(notification: NSNotification) { // 截屏事件的处理逻辑 } ``` 在`handleScreenshot()`方法中,可以编写对截屏事件的处理逻辑。 请注意,在iOS平台上,监听截屏事件只能获取到截屏已经完成的通知,无法阻止截屏行为的发生。因为iOS系统保护了用户的隐私,不允许应用直接干涉截屏操作。以上方法只适用于监听截屏事件并作出响应,而无法禁止截屏行为的发生。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值