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 <objc/objc-runtime.h> | |
// [super description]; | |
struct objc_super s = {self, [self superclass]}; | |
objc_msgSendSuper(&s, @selector(description)); |
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 <UIKit/UIKit.h> | |
#define UI_MAIN_SCREEN_SCALE() ([UIScreen instancesRespondToSelector:@selector(scale)] ? [UIScreen mainScreen].scale : 1.0f) | |
static inline CGFloat CGFloatRoundToScale(CGFloat value, CGFloat scale) | |
{ | |
return roundf(value * scale) / scale; | |
} | |
static inline CGFloat CGFloatRoundToMainScreen(CGFloat value) |
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 DATA(str) [(NSString*)(str) dataUsingEncoding:NSUTF8StringEncoding] | |
- (NSData *)generateFormData:(NSDictionary *)dictionary boundary:(NSString *)boundary { | |
NSMutableData *data = [[NSMutableData alloc] init]; | |
id key; | |
NSEnumerator *enumerator = [dictionary keyEnumerator]; | |
while (key = [enumerator nextObject]) { | |
id value = [dictionary valueForKey:key]; | |
[data appendData:DATA(([NSString stringWithFormat:@"--%@\r\n", boundary]))]; |
NewerOlder