-
Notifications
You must be signed in to change notification settings - Fork 11
/
SIShortcutsMacro.h
67 lines (57 loc) · 3.15 KB
/
SIShortcutsMacro.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// SIShortcutsMacros.h
// Category
//
// Created by Silence on 16/02/2017.
// Copyright © 2017 silence. All rights reserved.
//
// 加载本地字符串
#ifndef LOCALIZED_STRING
#define LOCALIZED_STRING(string) NSLocalizedString(string, nil)
#else
#pragma message("LOCALIZED_STRING already declared")
#endif
#define LANG LOCALIZED_STRING(@"globals.lang")
#define LANG_DISPLAY LOCALIZED_STRING(@"globals.langDisplay")
// 单例对象
#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
#define FILE_MANAGER [NSFileManager defaultManager]
#define MAIN_BUNDLE [NSBundle mainBundle]
#define MAIN_THREAD [NSThread mainThread]
#define MAIN_SCREEN [UIScreen mainScreen]
#define USER_DEFAULTS [NSUserDefaults standardUserDefaults]
#define APPLICATION [UIApplication sharedApplication]
#define CURRENT_DEVICE [UIDevice currentDevice]
#define MAIN_RUN_LOOP [NSRunLoop mainRunLoop]
#define GENERAL_PASTEBOARD [UIPasteboard generalPasteboard]
#define KEY_WINDOW [[UIApplication sharedApplication] keyWindow]
// 字体
#define FONT(size) [UIFont systemFontOfSize:size]
#define BOLD_FONT(size) [UIFont boldSystemFontOfSize:size]
// 网络
#define NETWORK_ACTIVITY [APPLICATION networkActivityIndicatorVisible]
// 归档
#define OBJECT2DATA(object) [NSKeyedArchiver archivedDataWithRootObject:object]
#define DATA2OBJECT(data) [NSKeyedUnarchiver unarchiveObjectWithData:data]
// Application信息
#define APPLICATION_NAME [MAIN_BUNDLE objectForInfoDictionaryKey:@"CFBundleDisplayName"]
#define APPLICATION_VERSION [MAIN_BUNDLE objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
#define APPLICATION_BUILD_VERSION [MAIN_BUNDLE objectForInfoDictionaryKey:@"CFBundleVersion"]
#define APPLICATION_BUNDLE_ID [MAIN_BUNDLE objectForInfoDictionaryKey:@"CFBundleIdentifier"]
//设置屏幕亮度
#define DECVICE_BRIGHTNESS(brightness) [[UIScreen mainScreen] setBrightness:brightness];
//设置屏幕常亮
#define DECVICE_NORMALLYON(isNornallyOn) [[UIApplication sharedApplication] setIdleTimerDisabled:isNornallyOn];
// USER_DEFAULTS
#define USER_DEFAULTS [NSUserDefaults standardUserDefaults]
#define USER_DEFAULTS_SET_OBJECT_FOR_KEY(__VALUE__,__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] setObject:__VALUE__ forKey:__KEY__];\
[[NSUserDefaults standardUserDefaults] synchronize];\
}
#define USER_DEFAULTS_OBJECT_FOR_KEY(__KEY__) [[NSUserDefaults standardUserDefaults] objectForKey:__KEY__]
#define USER_DEFAULTS_REMOVE_OBJECT_FOR_KEY(__KEY__) \
{\
[[NSUserDefaults standardUserDefaults] removeObjectForKey:__KEY__];\
[[NSUserDefaults standardUserDefaults] synchronize];\
}