// // MYFactoryManager.m // GoHiking_app // // Created by dwl on 17/10/13. // Copyright (c) 2017年 dwl. All rights reserved. // #import "MYFactoryManager.h" @interface MYFactoryManager () @end @implementation MYFactoryManager #pragma mark ============================>> SDK 单例 static MYFactoryManager * instance; +(instancetype)sharedInstance{ return [[self alloc] init]; } + (instancetype)allocWithZone:(struct _NSZone *)zone{ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ instance = [super allocWithZone:zone]; }); return instance; } - (instancetype)init{ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ instance = [super init]; }); return instance; } #pragma mark --------------------------------------------------------------- UI编辑 //添加边框 + (void)makeBoundsWithView:(UIView *)view color:(UIColor *)color width:(CGFloat)width{ view.layer.borderColor = color.CGColor; view.layer.borderWidth = width; } //控件剪切圆角 + (void)clipsToBoundsWithView:(UIView *)view Radius:(NSInteger)radius{ view.layer.cornerRadius = radius; view.layer.masksToBounds = YES; } //正常加载还是打包后sdk加载 +(UIImage*)imageString:(NSString*)imageName{ BOOL ifSdk = YES; UIImage *orangeImage; if (ifSdk==YES){//打包成sdk后 加载imageUrl要用[self class]的方式 NSBundle * refreshBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"IOSToUnityBundle" ofType:@"bundle"]]; if (orangeImage == nil){ orangeImage = [[UIImage imageWithContentsOfFile:[refreshBundle pathForResource:imageName ofType:@"png"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; } }else{ orangeImage = [UIImage imageNamed:imageName]; } return orangeImage; } //#pragma mark ------ 发送app group通知 //+ (void)postGroupCFNotificaiton:(NSString*)string{ // // NSString * notificaitonName = @"OPEN_NOTIFICATION"; // CFStringRef strRef = (__bridge CFStringRef)notificaitonName; // CFNotificationCenterRef notification = CFNotificationCenterGetDarwinNotifyCenter (); // //第一种生成参数方法 测试无效 //// NSDictionary * ocDict = @{@"key":@"123"}; //// CFDictionaryRef dicRef = (__bridge CFDictionaryRef)ocDict; // //第二种 共享沙河数据 // NSUserDefaults* userDefault = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.Oujia.AppAndGame"]; // [userDefault setObject:string forKey:@"type"];//主副设备 断开的type // [userDefault synchronize]; // //之后发送通知 // CFNotificationCenterPostNotification(notification, strRef, NULL,nil, YES); // // // //} @end