Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only do the new tinting in iOS7

  • Loading branch information...
commit 93cba25ff01489cf2d5ec64b73332024d9a47eff 1 parent 6bf5dd1
Chris Hellmuth authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 quickdialog/QEntryTableViewCell.m
View
16 quickdialog/QEntryTableViewCell.m
@@ -12,6 +12,13 @@
// permissions and limitations under the License.
//
+static BOOL isAtLeastIos7() {
+ NSString *currentOsVersionStr = [[UIDevice currentDevice] systemVersion];
+ float currentOSFlt = currentOsVersionStr.floatValue;
+ return (currentOSFlt >= 7.f);
+}
+
+
@interface QEntryTableViewCell ()
- (void)handleActionBarPreviousNext:(UISegmentedControl *)control;
- (QEntryElement *)findNextElementToFocusOn;
@@ -25,24 +32,27 @@ @implementation QEntryTableViewCell {
-(UIToolbar *)createActionBar {
UIToolbar *actionBar = [[UIToolbar alloc] init];
actionBar.translucent = YES;
- actionBar.tintColor = [UIColor whiteColor];
[actionBar sizeToFit];
actionBar.barStyle = UIBarStyleBlackTranslucent;
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", @"")
style:UIBarButtonItemStyleDone target:self
action:@selector(handleActionBarDone:)];
- doneButton.tintColor = [UIColor whiteColor];
_prevNext = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:NSLocalizedString(@"Previous", @""), NSLocalizedString(@"Next", @""), nil]];
_prevNext.momentary = YES;
_prevNext.segmentedControlStyle = UISegmentedControlStyleBar;
- _prevNext.tintColor = actionBar.tintColor;
[_prevNext addTarget:self action:@selector(handleActionBarPreviousNext:) forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *prevNextWrapper = [[UIBarButtonItem alloc] initWithCustomView:_prevNext];
UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action: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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.