Skip to content

Commit

Permalink
Only do the new tinting in iOS7
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Hellmuth committed Feb 13, 2014
1 parent 6bf5dd1 commit 93cba25
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions quickdialog/QEntryTableViewCell.m
Expand Up @@ -12,6 +12,13 @@
// permissions and limitations under the License. // permissions and limitations under the License.
// //


static BOOL isAtLeastIos7() {
NSString *currentOsVersionStr = [[UIDevice currentDevice] systemVersion];
float currentOSFlt = currentOsVersionStr.floatValue;
return (currentOSFlt >= 7.f);
}


@interface QEntryTableViewCell () @interface QEntryTableViewCell ()
- (void)handleActionBarPreviousNext:(UISegmentedControl *)control; - (void)handleActionBarPreviousNext:(UISegmentedControl *)control;
- (QEntryElement *)findNextElementToFocusOn; - (QEntryElement *)findNextElementToFocusOn;
Expand All @@ -25,24 +32,27 @@ @implementation QEntryTableViewCell {
-(UIToolbar *)createActionBar { -(UIToolbar *)createActionBar {
UIToolbar *actionBar = [[UIToolbar alloc] init]; UIToolbar *actionBar = [[UIToolbar alloc] init];
actionBar.translucent = YES; actionBar.translucent = YES;
actionBar.tintColor = [UIColor whiteColor];
[actionBar sizeToFit]; [actionBar sizeToFit];
actionBar.barStyle = UIBarStyleBlackTranslucent; actionBar.barStyle = UIBarStyleBlackTranslucent;


UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", @"") UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", @"")
style:UIBarButtonItemStyleDone target:self style:UIBarButtonItemStyleDone target:self
action:@selector(handleActionBarDone:)]; action:@selector(handleActionBarDone:)];
doneButton.tintColor = [UIColor whiteColor];


_prevNext = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:NSLocalizedString(@"Previous", @""), NSLocalizedString(@"Next", @""), nil]]; _prevNext = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:NSLocalizedString(@"Previous", @""), NSLocalizedString(@"Next", @""), nil]];
_prevNext.momentary = YES; _prevNext.momentary = YES;
_prevNext.segmentedControlStyle = UISegmentedControlStyleBar; _prevNext.segmentedControlStyle = UISegmentedControlStyleBar;
_prevNext.tintColor = actionBar.tintColor;
[_prevNext addTarget:self action:@selector(handleActionBarPreviousNext:) forControlEvents:UIControlEventValueChanged]; [_prevNext addTarget:self action:@selector(handleActionBarPreviousNext:) forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *prevNextWrapper = [[UIBarButtonItem alloc] initWithCustomView:_prevNext]; UIBarButtonItem *prevNextWrapper = [[UIBarButtonItem alloc] initWithCustomView:_prevNext];
UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[actionBar setItems:[NSArray arrayWithObjects:prevNextWrapper, flexible, doneButton, nil]]; [actionBar setItems:[NSArray arrayWithObjects:prevNextWrapper, flexible, doneButton, nil]];


if (isAtLeastIos7()) {
doneButton.tintColor = [UIColor whiteColor];
actionBar.tintColor = [UIColor whiteColor];
}
_prevNext.tintColor = actionBar.tintColor;

return actionBar; return actionBar;
} }


Expand Down

0 comments on commit 93cba25

Please sign in to comment.