This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface People : NSObject | |
- (People *(^)())run; | |
- (People *(^)())study; | |
- (People *(^)(NSString* name))name; | |
@end | |
@implementation People | |
- (People *(^)())run{ | |
return ^{ | |
NSLog(@"run"); | |
return self; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct __CFUserNotification *CFUserNotificationRef; | |
FOUNDATION_EXTERN CFUserNotificationRef CFUserNotificationCreate ( CFAllocatorRef allocator, CFTimeInterval timeout, CFOptionFlags flags, SInt32 *error, CFDictionaryRef dictionary ); | |
FOUNDATION_EXTERN SInt32 CFUserNotificationReceiveResponse ( CFUserNotificationRef userNotification, CFTimeInterval timeout, CFOptionFlags *responseFlags ); | |
FOUNDATION_EXTERN CFDictionaryRef CFUserNotificationGetResponseDictionary ( CFUserNotificationRef userNotification ); | |
//官方使用例子 | |
SInt32 CFUserNotificationDisplayNotice(CFTimeInterval timeout, CFOptionFlags flags, CFURLRef iconURL, CFURLRef soundURL, CFURLRef localizationURL, CFStringRef alertHeader, CFStringRef alertMessage, CFStringRef defaultButtonTitle) { | |
CHECK_FOR_FORK(); | |
CFUserNotificationRef userNotification; | |
SInt32 retval = ERR_SUCCESS; | |
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorSystemDefault, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFUserNotificationRef CFUserNotificationCreate(CFAllocatorRef allocator, CFTimeInterval timeout, CFOptionFlags flags, SInt32 *error, CFDictionaryRef dictionary) { | |
CHECK_FOR_FORK(); | |
CFUserNotificationRef userNotification = NULL; | |
SInt32 retval = ERR_SUCCESS; | |
static uint16_t tokenCounter = 0; | |
SInt32 token = ((getpid() << 16) | (tokenCounter++)); | |
CFStringRef sessionID = (dictionary ? CFDictionaryGetValue(dictionary, kCFUserNotificationSessionIDKey) : NULL); | |
mach_port_t replyPort = MACH_PORT_NULL; | |
if (!allocator) allocator = __CFGetDefaultAllocator(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
TABLENAME=symbols | |
SYMBOL_DB_FILE="symbols" | |
STRING_SYMBOL_FILE="func.list" | |
HEAD_FILE="$PROJECT_DIR/$PROJECT_NAME/codeObfuscation.h" | |
export LC_CTYPE=C | |
#维护数据库方便日后作排重 | |
createTable() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 优化之后的代码 | |
NSString *AlertHeader = [self title]; | |
NSLog(@"sb 弹框 title :%@ message:%@",AlertHeader,[self message]); | |
KNKNCFUserNotificationHandler handler = KNGHandlers[AlertHeader];//获取对应的block | |
if (handler) {// 存在之前定义block就执行 | |
// @{key:value,key:value...} | |
NSDictionary* dict = @{KNKNCFUserNotificationHandlerUIAlertControllerObjectKey:self}; | |
id res = handler(dict);// 获取block的返回结果, 把自己传递给外界 | |
if (res){ | |
NSLog(@"block res: %@",res); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *)openUDID{ | |
if (_openUDID == nil || [_openUDID isEqualToString:@""]) { | |
KNKeychainItemWrapper *wrapper = [[KNKeychainItemWrapper alloc] initWithIdentifier:@"kn.openUdid"accessGroup:nil]; | |
// 读测试 | |
NSString *openUDID = [wrapper objectForKey:(__bridge id)kSecValueData]; | |
NSLog(@"读出_openUDID:%@",openUDID); | |
if (openUDID == nil || [openUDID isEqualToString:@""]) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//方式一:有缓存(图片所占用的内存会一直停留在程序中) | |
+ (UIImage *)imageNamed:(NSString *)name;//name是图片的文件名 | |
//方式二:无缓存(图片所占用的内存会在一些特定操作后被清除) | |
+ (UIImage *)imageWithContentsOfFile:(NSString *)path | |
- (id)initWithContentsOfFile:(NSString *)path;//path是图片的全路径 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@property(nonatomic,copy) NSArray *animationImages; //需要播放的序列帧图片数组(里面都是UIImage对象,会按顺序显示里面的图片) | |
@property(nonatomic) NSTimeInterval animationDuration;//帧动画的持续时间 | |
@property(nonatomic) NSInteger animationRepeatCount; //帧动画的执行次数(默认是无限循环) | |
- (void)startAnimating;//开始执行帧动画 | |
- (void)stopAnimating;//停止执行帧动画 | |
- (BOOL)isAnimating;//是否正在执行帧动画 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSArray *)images | |
{ | |
if (_images == nil) { | |
NSBundle *bundle = [NSBundle mainBundle]; | |
NSString *path = [bundle pathForResource:@"imageData" ofType:@"plist"]; | |
_images = [NSArray arrayWithContentsOfFile:path]; | |
} | |
return _images; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var image = wx.createImage() | |
// 设置 Image 对象的 src 属性可以加载一张本地图片或网络图片,当图片加载完毕时会执行注册的 onload 回调函数,此时可以将 Image 对象绘制到 Canvas 上。 | |
image.onload = function () { | |
console.log(image.width, image.height) | |
context.drawImage(image, 0, 0) | |
} | |
image.src = 'logo.png' |
NewerOlder