Skip to content

Commit

Permalink
Merge pull request #6 from JaseElder/master
Browse files Browse the repository at this point in the history
added check for iPhone 4, to fix transparent view background problem.
  • Loading branch information
skywinder committed Jun 29, 2014
2 parents 5330942 + bd8c12a commit 3d8115e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Pickers/AbstractActionSheetPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@

#import "AbstractActionSheetPicker.h"
#import <objc/message.h>
#import <sys/utsname.h>

BOOL OSAtLeast(NSString* v) {
return [[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending;
}

BOOL isIPhone4() {
struct utsname systemInfo;
uname(&systemInfo);

NSString *modelName = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
return ([modelName rangeOfString:@"iPhone3"].location != NSNotFound);
}

@interface AbstractActionSheetPicker()

@property (nonatomic, strong) UIBarButtonItem *barButtonItem;
Expand Down Expand Up @@ -133,6 +142,9 @@ - (void)notifyTarget:(id)target didCancelWithAction:(SEL)cancelAction origin:(id

- (void)showActionSheetPicker {
UIView *masterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.viewSize.width, 260)];
if (isIPhone4()) {
masterView.backgroundColor = [UIColor colorWithRed:0.97 green:0.97 blue:0.97 alpha:1.0];
}
self.toolbar = [self createPickerToolbarWithTitle:self.title];
[masterView addSubview: self.toolbar];

Expand Down

0 comments on commit 3d8115e

Please sign in to comment.