Skip to content

Commit

Permalink
iOS 10 Support & Fix Transparency
Browse files Browse the repository at this point in the history
Merging changes from
guillermomuntaner#56
Which are not merged with the main branch yet.
  • Loading branch information
Hiren Patel committed Aug 8, 2016
1 parent 699de98 commit e51c311
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Examples/GMPhotoPicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
TargetAttributes = {
B37D577319CA3B3A007F64BD = {
CreatedOnToolsVersion = 6.0;
DevelopmentTeam = X5S967DLZ5;
DevelopmentTeam = DASAX5TMR3;
};
B37D578C19CA3B3A007F64BD = {
CreatedOnToolsVersion = 6.0;
Expand Down
2 changes: 2 additions & 0 deletions Examples/GMPhotoPicker/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSPhotoLibraryUsageDescription</key>
<string>Access media in Photos</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
7 changes: 1 addition & 6 deletions GMImagePicker/GMAlbumsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ - (void)viewDidLoad

// Register for changes
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];

if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
{
self.edgesForExtendedLayout = UIRectEdgeNone;
}
}

- (void)dealloc
Expand Down Expand Up @@ -350,7 +345,7 @@ -(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view f
{
UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
header.contentView.backgroundColor = [UIColor clearColor];
header.backgroundView.backgroundColor = [UIColor clearColor];
header.backgroundView.backgroundColor = self.picker.pickerBackgroundColor;

// Default is a bold font, but keep this styled as a normal font
header.textLabel.font = [UIFont fontWithName:self.picker.pickerFontName size:self.picker.pickerFontNormalSize];
Expand Down
5 changes: 0 additions & 5 deletions GMImagePicker/GMGridViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ - (void)viewDidLoad
self.imageManager = [[PHCachingImageManager alloc] init];
[self resetCachedAssets];
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];

if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
{
self.edgesForExtendedLayout = UIRectEdgeNone;
}
}

- (void)viewWillAppear:(BOOL)animated
Expand Down
8 changes: 6 additions & 2 deletions GMImagePicker/GMImagePickerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ static CGSize const kPopoverContentSize = {480, 720};
*
* - pickerBackgroundColor: The colour for all backgrounds; behind the table and cells. Defaults to [UIColor whiteColor]
* - pickerTextColor: The color for text in the views. This needs to work with pickerBackgroundColor! Default of darkTextColor
* - toolbarBarTintColor: The color for the background tint of the toolbar
* - toolbarBackgroundColor: The background color of the toolbar. Defaults to nil.
* - toolbarBarTintColor: The color for the background tint of the toolbar. Defaults to nil.
* - toolbarTextColor: The color of the text on the toolbar
* - toolbarTintColor: The tint colour used for any buttons on the toolbar
* - navigationBarBackgroundColor: The background of the navigation bar. Defaults to [UIColor whiteColor]
* - navigationBarBackgroundColor: The background of the navigation bar. Defaults to nil.
* - navigationBarBarTintColor: The color for the background tint of the navigation bar. Defaults to nil.
* - navigationBarTextColor: The color for the text in the navigation bar. Defaults to [UIColor darkTextColor]
* - navigationBarTintColor: The tint color used for any buttons on the navigation Bar
* - pickerFontName: The font to use everywhere. Defaults to HelveticaNeue. It is advised if you set this to check, and possibly set, appropriately the custom font sizes. For font information, check http://www.iosfonts.com/
Expand All @@ -152,10 +154,12 @@ static CGSize const kPopoverContentSize = {480, 720};
*/
@property (nonatomic, strong) UIColor *pickerBackgroundColor;
@property (nonatomic, strong) UIColor *pickerTextColor;
@property (nonatomic, strong) UIColor *toolbarBackgroundColor;
@property (nonatomic, strong) UIColor *toolbarBarTintColor;
@property (nonatomic, strong) UIColor *toolbarTextColor;
@property (nonatomic, strong) UIColor *toolbarTintColor;
@property (nonatomic, strong) UIColor *navigationBarBackgroundColor;
@property (nonatomic, strong) UIColor *navigationBarBarTintColor;
@property (nonatomic, strong) UIColor *navigationBarTextColor;
@property (nonatomic, strong) UIColor *navigationBarTintColor;
@property (nonatomic, strong) NSString *pickerFontName;
Expand Down
8 changes: 3 additions & 5 deletions GMImagePicker/GMImagePickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ - (id)init
_pickerFontNormalSize = 14.0f;
_pickerFontHeaderSize = 17.0f;

_navigationBarBackgroundColor = [UIColor whiteColor];
_navigationBarTextColor = [UIColor darkTextColor];
_navigationBarTintColor = [UIColor darkTextColor];

_toolbarBarTintColor = [UIColor whiteColor];
_toolbarTextColor = [UIColor darkTextColor];
_toolbarTintColor = [UIColor darkTextColor];

Expand All @@ -84,12 +82,14 @@ - (void)viewWillAppear:(BOOL)animated
self.view.backgroundColor = _pickerBackgroundColor;

_navigationController.toolbar.translucent = YES;
_navigationController.toolbar.backgroundColor = _toolbarBackgroundColor;
_navigationController.toolbar.barTintColor = _toolbarBarTintColor;
_navigationController.toolbar.tintColor = _toolbarTintColor;
[(UIView*)[_navigationController.toolbar.subviews objectAtIndex:0] setAlpha:0.75f]; // URGH - I know!

_navigationController.navigationBar.backgroundColor = _navigationBarBackgroundColor;
_navigationController.navigationBar.barTintColor = _navigationBarBarTintColor;
_navigationController.navigationBar.tintColor = _navigationBarTintColor;

NSDictionary *attributes;
if (_useCustomFontForNavigationBar) {
attributes = @{NSForegroundColorAttributeName : _navigationBarTextColor,
Expand All @@ -116,8 +116,6 @@ - (void)setupNavigationController
_navigationController.delegate = self;

_navigationController.navigationBar.translucent = YES;
[_navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
_navigationController.navigationBar.shadowImage = [UIImage new];

[_navigationController willMoveToParentViewController:self];
[_navigationController.view setFrame:self.view.frame];
Expand Down

0 comments on commit e51c311

Please sign in to comment.