Skip to content

Commit

Permalink
Made ViewController of example project work with simulator with undep…
Browse files Browse the repository at this point in the history
…recated methods.
  • Loading branch information
tfrank64 committed Jan 30, 2014
1 parent e233604 commit aad7616
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions Example/FlatUIKitExample/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
#import "FUISegmentedControl.h"
#import "UIPopoverController+FlatUI.h"

#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)

@interface ViewController () {
UIPopoverController *_popoverController;
}
Expand Down Expand Up @@ -86,8 +92,15 @@ - (void)viewDidLoad
disabledColor:[UIColor amethystColor]
iconColor:[UIColor cloudsColor]];

self.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeFont: [UIFont boldFlatFontOfSize:18],
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
self.navigationController.navigationBar.titleTextAttributes = @{NSFontAttributeName:[UIFont boldFlatFontOfSize:18],
NSForegroundColorAttributeName: [UIColor whiteColor]};
} else {
// Pre-iOS7 methods
self.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeFont: [UIFont boldFlatFontOfSize:18],
UITextAttributeTextColor: [UIColor whiteColor]};
}

[self.navigationController.navigationBar configureFlatNavigationBarWithColor:[UIColor midnightBlueColor]];

self.flatSwitch.onColor = [UIColor turquoiseColor];
Expand Down Expand Up @@ -144,11 +157,19 @@ - (IBAction)showPopover:(id)sender {
UIButton *button = (UIButton *)sender;

UIViewController *vc = [[UIViewController alloc] init];
vc.contentSizeForViewInPopover = CGSizeMake(320, 480);
vc.view.backgroundColor = [UIColor whiteColor];
vc.title = @"FUIPopoverController";
vc.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeFont: [UIFont boldFlatFontOfSize:18],

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
vc.preferredContentSize = CGSizeMake(320, 480);
self.navigationController.navigationBar.titleTextAttributes = @{NSFontAttributeName:[UIFont boldFlatFontOfSize:18],
NSForegroundColorAttributeName: [UIColor whiteColor]};
} else {
// Pre-iOS7 methods
vc.contentSizeForViewInPopover = CGSizeMake(320, 480);
vc.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeFont: [UIFont boldFlatFontOfSize:18],
UITextAttributeTextColor: [UIColor whiteColor]};
}

UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];

Expand Down

0 comments on commit aad7616

Please sign in to comment.