Unverified Commit a19d719d authored by 谭真's avatar 谭真 Committed by GitHub

Merge pull request #1382 from iiHorizon/master

support dark mode
parents 700c982c 7a087f9d
...@@ -408,7 +408,11 @@ ...@@ -408,7 +408,11 @@
- (void)setModel:(TZAlbumModel *)model { - (void)setModel:(TZAlbumModel *)model {
_model = model; _model = model;
NSMutableAttributedString *nameString = [[NSMutableAttributedString alloc] initWithString:model.name attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor blackColor]}]; UIColor *nameColor = UIColor.blackColor;
if (@available(iOS 13.0, *)) {
nameColor = UIColor.labelColor;
}
NSMutableAttributedString *nameString = [[NSMutableAttributedString alloc] initWithString:model.name attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:nameColor}];
NSAttributedString *countString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@" (%zd)",model.count] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor lightGrayColor]}]; NSAttributedString *countString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@" (%zd)",model.count] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor lightGrayColor]}];
[nameString appendAttributedString:countString]; [nameString appendAttributedString:countString];
self.titleLabel.attributedText = nameString; self.titleLabel.attributedText = nameString;
...@@ -461,7 +465,11 @@ ...@@ -461,7 +465,11 @@
if (_titleLabel == nil) { if (_titleLabel == nil) {
UILabel *titleLabel = [[UILabel alloc] init]; UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.font = [UIFont boldSystemFontOfSize:17]; titleLabel.font = [UIFont boldSystemFontOfSize:17];
titleLabel.textColor = [UIColor blackColor]; if (@available(iOS 13.0, *)) {
titleLabel.textColor = UIColor.labelColor;
} else {
titleLabel.textColor = [UIColor blackColor];
}
titleLabel.textAlignment = NSTextAlignmentLeft; titleLabel.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:titleLabel]; [self.contentView addSubview:titleLabel];
_titleLabel = titleLabel; _titleLabel = titleLabel;
......
...@@ -777,7 +777,11 @@ ...@@ -777,7 +777,11 @@
if (!self->_tableView) { if (!self->_tableView) {
self->_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; self->_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
self->_tableView.rowHeight = 70; self->_tableView.rowHeight = 70;
self->_tableView.backgroundColor = [UIColor whiteColor]; if (@available(iOS 13.0, *)) {
self->_tableView.backgroundColor = [UIColor tertiarySystemBackgroundColor];
} else {
self->_tableView.backgroundColor = [UIColor whiteColor];
}
self->_tableView.tableFooterView = [[UIView alloc] init]; self->_tableView.tableFooterView = [[UIView alloc] init];
self->_tableView.dataSource = self; self->_tableView.dataSource = self;
self->_tableView.delegate = self; self->_tableView.delegate = self;
...@@ -847,6 +851,10 @@ ...@@ -847,6 +851,10 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
TZAlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TZAlbumCell"]; TZAlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TZAlbumCell"];
if (@available(iOS 13.0, *)) {
cell.backgroundColor = UIColor.tertiarySystemBackgroundColor;
} else {
}
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
cell.albumCellDidLayoutSubviewsBlock = imagePickerVc.albumCellDidLayoutSubviewsBlock; cell.albumCellDidLayoutSubviewsBlock = imagePickerVc.albumCellDidLayoutSubviewsBlock;
cell.albumCellDidSetModelBlock = imagePickerVc.albumCellDidSetModelBlock; cell.albumCellDidSetModelBlock = imagePickerVc.albumCellDidSetModelBlock;
......
...@@ -166,7 +166,11 @@ static CGFloat itemMargin = 5; ...@@ -166,7 +166,11 @@ static CGFloat itemMargin = 5;
if (!_collectionView) { if (!_collectionView) {
_layout = [[UICollectionViewFlowLayout alloc] init]; _layout = [[UICollectionViewFlowLayout alloc] init];
_collectionView = [[TZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout]; _collectionView = [[TZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout];
_collectionView.backgroundColor = [UIColor whiteColor]; if (@available(iOS 13.0, *)) {
_collectionView.backgroundColor = UIColor.tertiarySystemBackgroundColor;
} else {
_collectionView.backgroundColor = [UIColor whiteColor];
}
_collectionView.dataSource = self; _collectionView.dataSource = self;
_collectionView.delegate = self; _collectionView.delegate = self;
_collectionView.alwaysBounceHorizontal = NO; _collectionView.alwaysBounceHorizontal = NO;
...@@ -177,6 +181,7 @@ static CGFloat itemMargin = 5; ...@@ -177,6 +181,7 @@ static CGFloat itemMargin = 5;
} else { } else {
[_collectionView reloadData]; [_collectionView reloadData];
} }
if (_showTakePhotoBtn) { if (_showTakePhotoBtn) {
_collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + self.columnNumber) / self.columnNumber) * self.view.tz_width); _collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + self.columnNumber) / self.columnNumber) * self.view.tz_width);
...@@ -224,14 +229,22 @@ static CGFloat itemMargin = 5; ...@@ -224,14 +229,22 @@ static CGFloat itemMargin = 5;
_bottomToolBar = [[UIView alloc] initWithFrame:CGRectZero]; _bottomToolBar = [[UIView alloc] initWithFrame:CGRectZero];
CGFloat rgb = 253 / 255.0; CGFloat rgb = 253 / 255.0;
_bottomToolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0]; if (@available(iOS 13.0, *)) {
_bottomToolBar.backgroundColor = UIColor.tertiarySystemBackgroundColor;
} else {
_bottomToolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];
}
_previewButton = [UIButton buttonWithType:UIButtonTypeCustom]; _previewButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_previewButton addTarget:self action:@selector(previewButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_previewButton addTarget:self action:@selector(previewButtonClick) forControlEvents:UIControlEventTouchUpInside];
_previewButton.titleLabel.font = [UIFont systemFontOfSize:16]; _previewButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateNormal]; [_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateNormal];
[_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateDisabled]; [_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateDisabled];
[_previewButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; if (@available(iOS 13.0, *)) {
[_previewButton setTitleColor:UIColor.labelColor forState:UIControlStateNormal];
} else {
[_previewButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
}
[_previewButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled]; [_previewButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];
_previewButton.enabled = tzImagePickerVc.selectedModels.count; _previewButton.enabled = tzImagePickerVc.selectedModels.count;
...@@ -243,7 +256,11 @@ static CGFloat itemMargin = 5; ...@@ -243,7 +256,11 @@ static CGFloat itemMargin = 5;
[_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateNormal]; [_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateNormal];
[_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateSelected]; [_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateSelected];
[_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal]; [_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
[_originalPhotoButton setTitleColor:[UIColor blackColor] forState:UIControlStateSelected]; if (@available(iOS 13.0, *)) {
[_originalPhotoButton setTitleColor:[UIColor labelColor] forState:UIControlStateSelected];
} else {
[_originalPhotoButton setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
}
[_originalPhotoButton setImage:tzImagePickerVc.photoOriginDefImage forState:UIControlStateNormal]; [_originalPhotoButton setImage:tzImagePickerVc.photoOriginDefImage forState:UIControlStateNormal];
[_originalPhotoButton setImage:tzImagePickerVc.photoOriginSelImage forState:UIControlStateSelected]; [_originalPhotoButton setImage:tzImagePickerVc.photoOriginSelImage forState:UIControlStateSelected];
_originalPhotoButton.imageView.clipsToBounds = YES; _originalPhotoButton.imageView.clipsToBounds = YES;
...@@ -254,7 +271,11 @@ static CGFloat itemMargin = 5; ...@@ -254,7 +271,11 @@ static CGFloat itemMargin = 5;
_originalPhotoLabel = [[UILabel alloc] init]; _originalPhotoLabel = [[UILabel alloc] init];
_originalPhotoLabel.textAlignment = NSTextAlignmentLeft; _originalPhotoLabel.textAlignment = NSTextAlignmentLeft;
_originalPhotoLabel.font = [UIFont systemFontOfSize:16]; _originalPhotoLabel.font = [UIFont systemFontOfSize:16];
_originalPhotoLabel.textColor = [UIColor blackColor]; if (@available(iOS 13.0, *)) {
_originalPhotoLabel.textColor = [UIColor labelColor];
} else {
_originalPhotoLabel.textColor = [UIColor blackColor];
}
if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes]; if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes];
} }
...@@ -284,7 +305,19 @@ static CGFloat itemMargin = 5; ...@@ -284,7 +305,19 @@ static CGFloat itemMargin = 5;
_divideLine = [[UIView alloc] init]; _divideLine = [[UIView alloc] init];
CGFloat rgb2 = 222 / 255.0; CGFloat rgb2 = 222 / 255.0;
_divideLine.backgroundColor = [UIColor colorWithRed:rgb2 green:rgb2 blue:rgb2 alpha:1.0]; if (@available(iOS 13.0, *)) {
UIColor *divideLineDyColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull trainCollection) {
if ([trainCollection userInterfaceStyle] == UIUserInterfaceStyleLight) {
return [UIColor colorWithRed:rgb2 green:rgb2 blue:rgb2 alpha:1.0];
} else {
CGFloat lineDarkRgb = 100 / 255.0;
return [UIColor colorWithRed:lineDarkRgb green:lineDarkRgb blue:lineDarkRgb alpha:1.0];
}
}];
_divideLine.backgroundColor = divideLineDyColor;
} else {
_divideLine.backgroundColor = [UIColor colorWithRed:rgb2 green:rgb2 blue:rgb2 alpha:1.0];
}
[_bottomToolBar addSubview:_divideLine]; [_bottomToolBar addSubview:_divideLine];
[_bottomToolBar addSubview:_previewButton]; [_bottomToolBar addSubview:_previewButton];
......
...@@ -13,4 +13,5 @@ ...@@ -13,4 +13,5 @@
@property (nonatomic, strong) TZAssetModel *model; @property (nonatomic, strong) TZAssetModel *model;
@end @end
\ No newline at end of file
...@@ -27,8 +27,10 @@ ...@@ -27,8 +27,10 @@
UIStatusBarStyle _originStatusBarStyle; UIStatusBarStyle _originStatusBarStyle;
} }
@property (assign, nonatomic) BOOL needShowStatusBar; @property (assign, nonatomic) BOOL needShowStatusBar;
// iCloud无法同步提示UI // iCloud无法同步提示UI
@property (nonatomic, strong) UIView *iCloudErrorView; @property (nonatomic, strong) UIView *iCloudErrorView;
@end @end
#pragma clang diagnostic push #pragma clang diagnostic push
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment