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 @@
- (void)setModel:(TZAlbumModel *)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]}];
[nameString appendAttributedString:countString];
self.titleLabel.attributedText = nameString;
......@@ -461,7 +465,11 @@
if (_titleLabel == nil) {
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.font = [UIFont boldSystemFontOfSize:17];
if (@available(iOS 13.0, *)) {
titleLabel.textColor = UIColor.labelColor;
} else {
titleLabel.textColor = [UIColor blackColor];
}
titleLabel.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:titleLabel];
_titleLabel = titleLabel;
......
......@@ -777,7 +777,11 @@
if (!self->_tableView) {
self->_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
self->_tableView.rowHeight = 70;
if (@available(iOS 13.0, *)) {
self->_tableView.backgroundColor = [UIColor tertiarySystemBackgroundColor];
} else {
self->_tableView.backgroundColor = [UIColor whiteColor];
}
self->_tableView.tableFooterView = [[UIView alloc] init];
self->_tableView.dataSource = self;
self->_tableView.delegate = self;
......@@ -847,6 +851,10 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
TZAlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TZAlbumCell"];
if (@available(iOS 13.0, *)) {
cell.backgroundColor = UIColor.tertiarySystemBackgroundColor;
} else {
}
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
cell.albumCellDidLayoutSubviewsBlock = imagePickerVc.albumCellDidLayoutSubviewsBlock;
cell.albumCellDidSetModelBlock = imagePickerVc.albumCellDidSetModelBlock;
......
......@@ -166,7 +166,11 @@ static CGFloat itemMargin = 5;
if (!_collectionView) {
_layout = [[UICollectionViewFlowLayout alloc] init];
_collectionView = [[TZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout];
if (@available(iOS 13.0, *)) {
_collectionView.backgroundColor = UIColor.tertiarySystemBackgroundColor;
} else {
_collectionView.backgroundColor = [UIColor whiteColor];
}
_collectionView.dataSource = self;
_collectionView.delegate = self;
_collectionView.alwaysBounceHorizontal = NO;
......@@ -178,6 +182,7 @@ static CGFloat itemMargin = 5;
[_collectionView reloadData];
}
if (_showTakePhotoBtn) {
_collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + self.columnNumber) / self.columnNumber) * self.view.tz_width);
} else {
......@@ -224,14 +229,22 @@ static CGFloat itemMargin = 5;
_bottomToolBar = [[UIView alloc] initWithFrame:CGRectZero];
CGFloat rgb = 253 / 255.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 addTarget:self action:@selector(previewButtonClick) forControlEvents:UIControlEventTouchUpInside];
_previewButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateNormal];
[_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateDisabled];
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.enabled = tzImagePickerVc.selectedModels.count;
......@@ -243,7 +256,11 @@ static CGFloat itemMargin = 5;
[_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateNormal];
[_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateSelected];
[_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
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.photoOriginSelImage forState:UIControlStateSelected];
_originalPhotoButton.imageView.clipsToBounds = YES;
......@@ -254,7 +271,11 @@ static CGFloat itemMargin = 5;
_originalPhotoLabel = [[UILabel alloc] init];
_originalPhotoLabel.textAlignment = NSTextAlignmentLeft;
_originalPhotoLabel.font = [UIFont systemFontOfSize:16];
if (@available(iOS 13.0, *)) {
_originalPhotoLabel.textColor = [UIColor labelColor];
} else {
_originalPhotoLabel.textColor = [UIColor blackColor];
}
if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes];
}
......@@ -284,7 +305,19 @@ static CGFloat itemMargin = 5;
_divideLine = [[UIView alloc] init];
CGFloat rgb2 = 222 / 255.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:_previewButton];
......
......@@ -14,3 +14,4 @@
@property (nonatomic, strong) TZAssetModel *model;
@end
......@@ -27,8 +27,10 @@
UIStatusBarStyle _originStatusBarStyle;
}
@property (assign, nonatomic) BOOL needShowStatusBar;
// iCloud无法同步提示UI
@property (nonatomic, strong) UIView *iCloudErrorView;
@end
#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