MYFactoryManager.m 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // MYFactoryManager.m
  3. // GoHiking_app
  4. //
  5. // Created by dwl on 17/10/13.
  6. // Copyright (c) 2017年 dwl. All rights reserved.
  7. //
  8. #import "MYFactoryManager.h"
  9. @interface MYFactoryManager ()
  10. @end
  11. @implementation MYFactoryManager
  12. #pragma mark ============================>> SDK 单例
  13. static MYFactoryManager * instance;
  14. +(instancetype)sharedInstance{
  15. return [[self alloc] init];
  16. }
  17. + (instancetype)allocWithZone:(struct _NSZone *)zone{
  18. static dispatch_once_t onceToken;
  19. dispatch_once(&onceToken, ^{
  20. instance = [super allocWithZone:zone];
  21. });
  22. return instance;
  23. }
  24. - (instancetype)init{
  25. static dispatch_once_t onceToken;
  26. dispatch_once(&onceToken, ^{
  27. instance = [super init];
  28. });
  29. return instance;
  30. }
  31. #pragma mark --------------------------------------------------------------- UI编辑
  32. //添加边框
  33. + (void)makeBoundsWithView:(UIView *)view color:(UIColor *)color width:(CGFloat)width{
  34. view.layer.borderColor = color.CGColor;
  35. view.layer.borderWidth = width;
  36. }
  37. //控件剪切圆角
  38. + (void)clipsToBoundsWithView:(UIView *)view Radius:(NSInteger)radius{
  39. view.layer.cornerRadius = radius;
  40. view.layer.masksToBounds = YES;
  41. }
  42. //正常加载还是打包后sdk加载
  43. +(UIImage*)imageString:(NSString*)imageName{
  44. BOOL ifSdk = YES;
  45. UIImage *orangeImage;
  46. if (ifSdk==YES){//打包成sdk后 加载imageUrl要用[self class]的方式
  47. NSBundle * refreshBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"IOSToUnityBundle" ofType:@"bundle"]];
  48. if (orangeImage == nil){
  49. orangeImage = [[UIImage imageWithContentsOfFile:[refreshBundle pathForResource:imageName ofType:@"png"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  50. }
  51. }else{
  52. orangeImage = [UIImage imageNamed:imageName];
  53. }
  54. return orangeImage;
  55. }
  56. //#pragma mark ------ 发送app group通知
  57. //+ (void)postGroupCFNotificaiton:(NSString*)string{
  58. //
  59. // NSString * notificaitonName = @"OPEN_NOTIFICATION";
  60. // CFStringRef strRef = (__bridge CFStringRef)notificaitonName;
  61. // CFNotificationCenterRef notification = CFNotificationCenterGetDarwinNotifyCenter ();
  62. // //第一种生成参数方法 测试无效
  63. //// NSDictionary * ocDict = @{@"key":@"123"};
  64. //// CFDictionaryRef dicRef = (__bridge CFDictionaryRef)ocDict;
  65. // //第二种 共享沙河数据
  66. // NSUserDefaults* userDefault = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.Oujia.AppAndGame"];
  67. // [userDefault setObject:string forKey:@"type"];//主副设备 断开的type
  68. // [userDefault synchronize];
  69. // //之后发送通知
  70. // CFNotificationCenterPostNotification(notification, strRef, NULL,nil, YES);
  71. // //
  72. //
  73. //}
  74. @end