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/NSNotificationCenter+YYAdd.m |   62 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/screendisplay/Pods/YYCategories/YYCategories/Foundation/NSNotificationCenter+YYAdd.m b/screendisplay/Pods/YYCategories/YYCategories/Foundation/NSNotificationCenter+YYAdd.m
new file mode 100755
index 0000000..5a35edc
--- /dev/null
+++ b/screendisplay/Pods/YYCategories/YYCategories/Foundation/NSNotificationCenter+YYAdd.m
@@ -0,0 +1,62 @@
+//
+//  NSNotificationCenter+YYAdd.m
+//  YYCategories <https://github.com/ibireme/YYCategories>
+//
+//  Created by ibireme on 13/8/24.
+//  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 "NSNotificationCenter+YYAdd.h"
+#include <pthread.h>
+#import "YYCategoriesMacro.h"
+
+YYSYNTH_DUMMY_CLASS(NSNotificationCenter_YYAdd)
+
+
+@implementation NSNotificationCenter (YYAdd)
+
+- (void)postNotificationOnMainThread:(NSNotification *)notification {
+    if (pthread_main_np()) return [self postNotification:notification];
+    [self postNotificationOnMainThread:notification waitUntilDone:NO];
+}
+
+- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait {
+    if (pthread_main_np()) return [self postNotification:notification];
+    [[self class] performSelectorOnMainThread:@selector(_yy_postNotification:) withObject:notification waitUntilDone:wait];
+}
+
+- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object {
+    if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:nil];
+    [self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO];
+}
+
+- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo {
+    if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
+    [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
+}
+
+- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait {
+    if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
+    NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3];
+    if (name) [info setObject:name forKey:@"name"];
+    if (object) [info setObject:object forKey:@"object"];
+    if (userInfo) [info setObject:userInfo forKey:@"userInfo"];
+    [[self class] performSelectorOnMainThread:@selector(_yy_postNotificationName:) withObject:info waitUntilDone:wait];
+}
+
++ (void)_yy_postNotification:(NSNotification *)notification {
+    [[self defaultCenter] postNotification:notification];
+}
+
++ (void)_yy_postNotificationName:(NSDictionary *)info {
+    NSString *name = [info objectForKey:@"name"];
+    id object = [info objectForKey:@"object"];
+    NSDictionary *userInfo = [info objectForKey:@"userInfo"];
+    
+    [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
+}
+
+@end

--
Gitblit v1.8.0