Device battery indicators on your Lock Screen
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

KAIStackView.mm 1.3KB

1234567891011121314151617181920212223242526272829303132333435
  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