Skip to content

Commit

Permalink
Merge pull request #1 from nebosuke/feature/support_ios13
Browse files Browse the repository at this point in the history
merge from nek023#220
  • Loading branch information
nebosuke authored Sep 24, 2019
2 parents 93ba9d5 + cdb8aa8 commit a4bb37b
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 40 deletions.
7 changes: 7 additions & 0 deletions QBImagePicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,11 @@
};
AAA8FE261ACDA0CE002A9710 = {
CreatedOnToolsVersion = 6.2;
DevelopmentTeam = V92SZ8966T;
};
AAA8FE3E1ACDA0CE002A9710 = {
CreatedOnToolsVersion = 6.2;
DevelopmentTeam = V92SZ8966T;
TestTargetID = AAA8FE261ACDA0CE002A9710;
};
};
Expand All @@ -434,6 +436,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
ja,
Expand Down Expand Up @@ -738,6 +741,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = V92SZ8966T;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -753,6 +757,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = V92SZ8966T;
INFOPLIST_FILE = QBImagePickerDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "jp.questbeat.$(PRODUCT_NAME:rfc1034identifier)";
Expand All @@ -764,6 +769,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = V92SZ8966T;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -781,6 +787,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
DEVELOPMENT_TEAM = V92SZ8966T;
INFOPLIST_FILE = QBImagePickerDemoTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
9 changes: 8 additions & 1 deletion QBImagePicker/QBAlbumsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ - (void)viewDidLoad
PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAny options:nil];
PHFetchResult *userAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:nil];
self.fetchResults = @[smartAlbums, userAlbums];

self.tableView.backgroundColor = self.imagePickerController.albumsBackgroundColor;
[self updateAssetCollections];

// Register observer
Expand All @@ -62,6 +62,10 @@ - (void)viewWillAppear:(BOOL)animated
self.navigationItem.title = NSLocalizedStringFromTableInBundle(@"albums.title", @"QBImagePicker", self.imagePickerController.assetBundle, nil);
self.navigationItem.prompt = self.imagePickerController.prompt;

self.navigationController.navigationBar.barTintColor = self.imagePickerController.navigationBarTintColor;
self.navigationController.navigationBar.tintColor = self.imagePickerController.navigationTintColor;
[self.navigationController.navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: self.imagePickerController.navigationTitleColor, NSForegroundColorAttributeName, nil]];

// Show/hide 'Done' button
if (self.imagePickerController.allowsMultipleSelection) {
[self.navigationItem setRightBarButtonItem:self.doneButton animated:NO];
Expand Down Expand Up @@ -277,6 +281,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
QBAlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AlbumCell" forIndexPath:indexPath];
cell.tag = indexPath.row;
cell.borderWidth = 1.0 / [[UIScreen mainScreen] scale];
cell.backgroundColor = self.imagePickerController.albumCellBackgroundColor;

// Thumbnail
PHAssetCollection *assetCollection = self.assetCollections[indexPath.row];
Expand Down Expand Up @@ -356,9 +361,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

// Album title
cell.titleLabel.text = assetCollection.localizedTitle;
cell.titleLabel.textColor = self.imagePickerController.albumCellTitleColor;

// Number of photos
cell.countLabel.text = [NSString stringWithFormat:@"%lu", (long)fetchResult.count];
cell.countLabel.textColor = self.imagePickerController.albumCellCountColor;

return cell;
}
Expand Down
14 changes: 7 additions & 7 deletions QBImagePicker/QBAssetsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ - (void)viewWillAppear:(BOOL)animated

// Configure collection view
self.collectionView.allowsMultipleSelection = self.imagePickerController.allowsMultipleSelection;
self.collectionView.backgroundColor = self.imagePickerController.assetsBackgroundColor;

self.navigationController.toolbar.barTintColor = self.imagePickerController.assetsToolbarBackgroundColor;

// Show/hide 'Done' button
if (self.imagePickerController.allowsMultipleSelection) {
Expand All @@ -105,12 +108,8 @@ - (void)viewWillAppear:(BOOL)animated

// Scroll to bottom
if (self.fetchResult.count > 0 && self.isMovingToParentViewController && !self.disableScrollToBottom) {
// when presenting as a .FormSheet on iPad, the frame is not correct until just after viewWillAppear:
// dispatching to the main thread waits one run loop until the frame is update and the layout is complete
dispatch_async(dispatch_get_main_queue(), ^{
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:(self.fetchResult.count - 1) inSection:0];
[self.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
});
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:(self.fetchResult.count - 1) inSection:0];
[self.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
}
}

Expand Down Expand Up @@ -197,7 +196,7 @@ - (void)setUpToolbarItems
UIBarButtonItem *rightSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL];

// Info label
NSDictionary *attributes = @{ NSForegroundColorAttributeName: [UIColor blackColor] };
NSDictionary *attributes = @{ NSForegroundColorAttributeName: self.imagePickerController.assetsToolbarTextColor };
UIBarButtonItem *infoButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:NULL];
infoButtonItem.enabled = NO;
[infoButtonItem setTitleTextAttributes:attributes forState:UIControlStateNormal];
Expand Down Expand Up @@ -501,6 +500,7 @@ - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView

// Number of assets
UILabel *label = (UILabel *)[footerView viewWithTag:1];
label.textColor = self.imagePickerController.assetCountColor;

NSBundle *bundle = self.imagePickerController.assetBundle;
NSUInteger numberOfPhotos = [self.fetchResult countOfAssetsWithMediaType:PHAssetMediaTypeImage];
Expand Down
Loading

0 comments on commit a4bb37b

Please sign in to comment.