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*)UDID { | |
NSString *uuidString = nil; | |
// get os version | |
NSUInteger currentOSVersion = [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] integerValue]; | |
if(currentOSVersion <= 5) { | |
if([[NSUserDefaults standardUserDefaults] valueForKey:@"udid"]) { | |
uuidString = [[NSUserDefaults standardDefaults] valueForKey:@"udid"]; | |
} else { | |
CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault); |
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
#define IS_HEIGHT_GTE_568 [[UIScreen mainScreen ] bounds].size.height >= 568.0f | |
typedef NS_ENUM(NSInteger, DeviceType) { | |
DeviceType_iPhone3Gs, | |
DeviceType_iPhone4_4s, | |
DeviceType_iPhone5, | |
}; | |
- (DeviceType)getTypeOfDevice { | |
if ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && |
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
#define IS_IOS_7 ([[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."][0] intValue] >= 7) | |
#define API_RQST_TIME_OUT 30 | |
// part of header file -------------------------------------------------------- | |
#import <Foundation/Foundation.h> | |
@protocol API_Handler <NSObject> | |
@required | |
- (void)didSuccess:(NSData*)data; | |
- (void)didFail:(NSError*)error; | |
@end |
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
// pass color & supply masked (masked with black-color) image | |
+ (UIImage *)applyColor:(UIColor *)color toImage:(UIImage*)toImage{ | |
// create context | |
UIGraphicsBeginImageContextWithOptions(toImage.size, NO, toImage.scale); | |
// get context reference | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
// Change the origin of the user coordinate system in a context. | |
CGContextTranslateCTM(context, 0, toImage.size.height); |
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 ALERT_WITH_TAG(NSUInteger tag,NSString *title, NSString *message,NSString *canceBtnTitle,id delegate,NSString *otherButtonTitles, ... ) | |
{ | |
UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:title | |
message:message | |
delegate:delegate | |
cancelButtonTitle:canceBtnTitle | |
otherButtonTitles:nil | |
]; | |
va_list args; |
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
#define DEBUG_MODE | |
#ifdef DEBUG_MODE | |
#define STLog(x,...) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(x), ##__VA_ARGS__]) | |
#else | |
#define STLog | |
#endif |
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 | |
createImagesets() { | |
for d in *; do | |
if [ -d $d ] ; then | |
(cd $d; createImagesets) | |
fi | |
if [ -f $d ] ; then | |
a=${d%@2x.*}; | |
dirname=$a".imageset"; |
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
// a function to take screen-shot of application's screen | |
- (UIImage*)takeScreenshot | |
{ | |
// get the key-window references | |
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; | |
// manipulate boundries of key-window | |
CGRect rect = [keyWindow bounds]; | |
// create context using size |
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
--comment | |
--step-1 - hide icons | |
defaults write com.apple.finder CreateDesktop -bool false | |
--step-2 - kill finder & relaunch | |
killall Finder |
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
--comment | |
--step-1 - show icons | |
defaults write com.apple.finder CreateDesktop -bool true | |
--step-2 - kill finder & relaunch | |
killall Finder |