Device battery indicators on your Lock Screen
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

35 lines
1.3KB

  1. @implementation KAIStackView
  2. - (id)initWithFrame:(CGRect)arg1 {
  3. self = [super initWithFrame:arg1];
  4. self.translatesAutoresizingMaskIntoConstraints = NO;
  5. return self;
  6. }
  7. - (void)addArrangedSubview:(UIView *)view {
  8. [super addArrangedSubview:view];
  9. [[KAIBatteryPlatter sharedInstance] setContentSize:self.frame.size];
  10. if (textColor == 0 && [view respondsToSelector:@selector(updateInfo)]) {
  11. KAIBatteryCell *cell = (KAIBatteryCell *)view;
  12. if (@available(iOS 12.0, *)) {
  13. if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
  14. [cell.label setTextColor:[UIColor whiteColor]];
  15. [cell.percentLabel setTextColor:[UIColor whiteColor]];
  16. } else if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
  17. [cell.label setTextColor:[UIColor blackColor]];
  18. [cell.percentLabel setTextColor:[UIColor blackColor]];
  19. }
  20. }
  21. }
  22. [[KAIBatteryPlatter sharedInstance] performSelector:@selector(resetOffset) withObject:[KAIBatteryPlatter sharedInstance] afterDelay:0.2];
  23. }
  24. - (void)removeArrangedSubview:(UIView *)subview {
  25. [super removeArrangedSubview:subview];
  26. [[KAIBatteryPlatter sharedInstance] performSelector:@selector(resetOffset) withObject:[KAIBatteryPlatter sharedInstance] afterDelay:0.2];
  27. }
  28. @end