Device battery indicators on your Lock Screen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1KB

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