@@ -29,6 +29,14 @@ static bool isLimitedPermission() {
29
29
return false ;
30
30
}
31
31
32
+ static bool isDarkMode () {
33
+ if (@available (iOS 13.0 , *)) {
34
+ UITraitCollection *current = UITraitCollection.currentTraitCollection ;
35
+ return current.userInterfaceStyle == UIUserInterfaceStyleDark;
36
+ }
37
+ return false ;
38
+ }
39
+
32
40
@interface QBImagePickerController (Private)
33
41
34
42
@property (nonatomic , strong ) NSBundle *assetBundle;
@@ -317,11 +325,16 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
317
325
UITableViewCell *cell = [[UITableViewCell alloc ] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: nil ];
318
326
cell.tag = indexPath.row ;
319
327
cell.selectionStyle = UITableViewCellSelectionStyleNone;
320
- [cell setBackgroundColor: [UIColor colorWithRed: 0.97 green: 0.97 blue: 0.97 alpha: 1.00 ]];
321
-
322
328
UIButton *manageButton = [UIButton buttonWithType: UIButtonTypeSystem];
323
- [manageButton setBackgroundColor: [UIColor colorWithRed: 0.87 green: 0.87 blue: 0.87 alpha: 1.00 ]];
324
- [manageButton setTitleColor: [UIColor blackColor ] forState: UIControlStateNormal];
329
+ if (isDarkMode ()) {
330
+ [cell setBackgroundColor: [UIColor colorWithRed: 0.03 green: 0.03 blue: 0.03 alpha: 1.00 ]];
331
+ [manageButton setBackgroundColor: [UIColor colorWithRed: 0.13 green: 0.13 blue: 0.13 alpha: 1.00 ]];
332
+ [manageButton setTitleColor: [UIColor whiteColor ] forState: UIControlStateNormal];
333
+ } else {
334
+ [cell setBackgroundColor: [UIColor colorWithRed: 0.95 green: 0.95 blue: 0.95 alpha: 1.00 ]];
335
+ [manageButton setBackgroundColor: [UIColor colorWithRed: 0.85 green: 0.85 blue: 0.85 alpha: 1.00 ]];
336
+ [manageButton setTitleColor: [UIColor blackColor ] forState: UIControlStateNormal];
337
+ }
325
338
[manageButton addTarget: self action: @selector (managePermissionAction: ) forControlEvents: UIControlEventTouchUpInside];
326
339
manageButton.layer .cornerRadius = 12 ;
327
340
manageButton.contentEdgeInsets = UIEdgeInsetsMake (4 , 12 , 4 , 12 );
0 commit comments