From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/Pods/YYCategories/YYCategories/Foundation/NSObject+YYAddForKVO.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/YYCategories/YYCategories/Foundation/NSObject+YYAddForKVO.h b/screendisplay/Pods/YYCategories/YYCategories/Foundation/NSObject+YYAddForKVO.h new file mode 100755 index 0000000..b3f1df1 --- /dev/null +++ b/screendisplay/Pods/YYCategories/YYCategories/Foundation/NSObject+YYAddForKVO.h @@ -0,0 +1,54 @@ +// +// NSObject+YYAddForKVO.h +// YYCategories <https://github.com/ibireme/YYCategories> +// +// Created by ibireme on 14/10/15. +// Copyright (c) 2015 ibireme. +// +// This source code is licensed under the MIT-style license found in the +// LICENSE file in the root directory of this source tree. +// + +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +/** + Observer with block (KVO). + */ +@interface NSObject (YYAddForKVO) + +/** + Registers a block to receive KVO notifications for the specified key-path + relative to the receiver. + + @discussion The block and block captured objects are retained. Call + `removeObserverBlocksForKeyPath:` or `removeObserverBlocks` to release. + + @param keyPath The key path, relative to the receiver, of the property to + observe. This value must not be nil. + + @param block The block to register for KVO notifications. + */ +- (void)addObserverBlockForKeyPath:(NSString*)keyPath + block:(void (^)(id _Nonnull obj, id _Nonnull oldVal, id _Nonnull newVal))block; + +/** + Stops all blocks (associated by `addObserverBlockForKeyPath:block:`) from + receiving change notifications for the property specified by a given key-path + relative to the receiver, and release these blocks. + + @param keyPath A key-path, relative to the receiver, for which blocks is + registered to receive KVO change notifications. + */ +- (void)removeObserverBlocksForKeyPath:(NSString*)keyPath; + +/** + Stops all blocks (associated by `addObserverBlockForKeyPath:block:`) from + receiving change notifications, and release these blocks. + */ +- (void)removeObserverBlocks; + +@end + +NS_ASSUME_NONNULL_END -- Gitblit v1.8.0