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
// System Versioning Preprocessor Macros | |
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) | |
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) | |
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) | |
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) | |
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) |
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
#ifdef DEBUG | |
#ifdef TESTFLIGHT | |
#define LOG_NETWORK(level, ...) TFLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) | |
#define LOG_GENERAL(level, ...) TFLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) | |
#define LOG_GRAPHICS(level, ...) TFLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) | |
#define LOG_MEMORY(level, ...) TFLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) | |
#else | |
#define LOG_NETWORK(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"network",level,__VA_ARGS__);LoggerFlush(NULL,YES);} | |
#define LOG_GENERAL(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"general",level,__VA_ARGS__);LoggerFlush(NULL,YES);} | |
#define LOG_GRAPHICS(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"graphics",level,__VA_ARGS__);LoggerFlush(NULL,YES);} |
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 *) currentLanguage | |
{ | |
return [NSUserDefaults standardUserDefaults][@"AppleLanguages"][0]; | |
} |
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
// | |
// Created by Cédric Luthi on 2012-02-24. | |
// Copyright (c) 2012 Cédric Luthi. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSData (Base64) | |
+ (id) dataWithBase64Encoding_xcd:(NSString *)base64String; |
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
#import "LoggerClient.h" | |
#ifdef DEBUG | |
#define LOG_NETWORK(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"network",level,__VA_ARGS__);LoggerFlush(NULL,YES);} | |
#define LOG_GENERAL(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"general",level,__VA_ARGS__);LoggerFlush(NULL,YES);} | |
#define LOG_GRAPHICS(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"graphics",level,__VA_ARGS__);LoggerFlush(NULL,YES);} | |
#define LOG_MEMORY(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"memory",level,__VA_ARGS__);LoggerFlush(NULL,YES);} | |
#else | |
#define LOG_NETWORK(...) do{}while(0) | |
#define LOG_GENERAL(...) do{}while(0) | |
#define LOG_GRAPHICS(...) do{}while(0) |
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
#!/bin/bash | |
################################################################################ | |
# This script will create universal binaries for OpenCV library for | |
# iOS-based devices (iPhone, iPad, iPod, etc). | |
# As output you obtain debug/release static libraries and include headers. | |
# | |
# This script was written by Eugene Khvedchenya | |
# And distributed under GPL license | |
# Support site: http://computer-vision-talks.com | |
################################################################################</p> |
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
id obj = someInstance; | |
if ([obj isKindOfClass:someClass]) | |
{ | |
someClass *classSpecifiedInstance = (someClass *)obj; | |
// Do Something to classSpecifiedInstance which now is an instance of someClass | |
//... | |
} |
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
void dynamicMethodIMP(id self, SEL _cmd) | |
{ | |
// implementation .... | |
} | |
//该方法在OC消息转发生效前被调用 | |
+ (BOOL) resolveInstanceMethod:(SEL)aSEL | |
{ | |
if (aSEL == @selector(resolveThisMethodDynamically)) | |
{ |
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
+(BOOL)swizze { | |
Method oldMethod = class_getInstanceMethod(self, @selector(loadNibNamed:owner:options:)); | |
if (!oldMethod) { | |
return NO; | |
} | |
Method newMethod = class_getInstanceMethod(self, @selector(loadPadNibNamed:owner:options:)); | |
if (!newMethod) { | |
return NO; | |
} |
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 *)loadPadNibNamed:(NSString *)name owner:(id)owner options:(NSDictionary *)options { | |
NSString *newName = [name stringByReplacingOccurrencesOfString:@"@pad" withString:@""]; | |
newName = [newName stringByAppendingFormat:@"@pad"]; | |
//判断是否存在 | |
NSFileManager *fm = [NSFileManager defaultManager]; | |
NSString* filepath = [[NSBundle mainBundle] pathForResource:newName ofType:@"nib"]; | |
//这里调用的loadPadNibNamed:owner:options:实际为为交换后的方法,即loadNibNamed:owner:options: | |
if ([fm fileExistsAtPath:filepath]) { |
OlderNewer