This file contains hidden or 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_7_0 (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) | |
#define IS_PAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | |
#define IS_PHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) | |
#define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0f) | |
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] | |
#ifdef DEBUG | |
# define LOG_MESSAGE(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); |
This file contains hidden or 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
self.currentItem = item; | |
RACSignal *itemChanged = [[RACObserve(self, currentItem) skip:1] take:1]; | |
// prepare item until switched to other item | |
RACSignal *itemReady = [[item rac_prepareItem] takeUntil:itemChanged]; | |
// show description if preparation takes more than 1 second | |
[[[[[RACSignal interval:1.] take:1] | |
takeUntil:itemReady] | |
deliverOn:[RACScheduler mainThreadScheduler]] |
This file contains hidden or 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 MultilineLabel : UILabel | |
@property (nonatomic) CGFloat maximumWidth; | |
@end | |
@implementation MultilineLabel | |
- (id)initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; | |
if (self) { | |
_maximumWidth = 200; |
This file contains hidden or 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
// example: [self colorizeStack:self.view]; | |
- (void)colorizeStack:(UIView *)view { | |
CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 | |
CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white | |
CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black | |
UIColor *color = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:0.8]; | |
view.backgroundColor = color; | |
for (UIView *subView in view.subviews) { |
This file contains hidden or 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
Now API looks like this: | |
- (void)getTapPoints; | |
- (void)spendTapPoints; | |
Here is how it would be absolutely awesome: | |
- (void)getTapPointsCompletion:(void (^)(TapjoyConnect *tj, NSUInteger tapPoints, NSError *error))completionBlock; | |
- (void)spendTapPoints:100 completion:(void (^)(TapjoyConnect *tj, NSError *error))completionBlock; | |
So, I could use it like this: | |
.. code .. |
NewerOlder