Skip to content

Commit

Permalink
Added macro to check if iOS version is >= 5.0 at both compile and run…
Browse files Browse the repository at this point in the history
…ning time + fix spinner setColor on older iOS versions (spinners color set to gray). Closes Simbul#182
  • Loading branch information
Xm4s committed Oct 24, 2011
1 parent 6b4b391 commit 51f0d73
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Classes/RootViewController.m
Expand Up @@ -57,6 +57,19 @@

#define INDEX_FILE_NAME @"index.html"

// IOS VERSION >= 5.0 MACRO
#ifndef kCFCoreFoundationVersionNumber_iPhoneOS_5_0
#define kCFCoreFoundationVersionNumber_iPhoneOS_5_0 675.00
#endif
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0
#define IF_IOS5_OR_GREATER(...) \
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iPhoneOS_5_0) { \
__VA_ARGS__ \
}
#else
#define IF_IOS5_OR_GREATER(...)
#endif

@implementation RootViewController

#pragma mark - SYNTHESIS
Expand Down Expand Up @@ -241,10 +254,12 @@ - (void)initPageDetails {
[backgroundView release];

// ****** Spinners
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] init];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.backgroundColor = [UIColor clearColor];
spinner.color = foregroundColor;
spinner.alpha = [(NSNumber*) foregroundAlpha floatValue];
IF_IOS5_OR_GREATER(
spinner.color = foregroundColor;
spinner.alpha = [(NSNumber*) foregroundAlpha floatValue];
);

CGRect frame = spinner.frame;
frame.origin.x = pageWidth * i + (pageWidth - frame.size.width) / 2;
Expand Down

0 comments on commit 51f0d73

Please sign in to comment.