Browse Source

its code

pull/1/head
Burrit0z 4 years ago
parent
commit
e7c0f5543c
1 changed files with 30 additions and 18 deletions
  1. +30
    -18
      Kai.xm

+ 30
- 18
Kai.xm View File

%property (nonatomic, assign) BOOL hasKai; %property (nonatomic, assign) BOOL hasKai;
%property (nonatomic, assign) NSInteger previousKaiCount; %property (nonatomic, assign) NSInteger previousKaiCount;


-(id)initWithFrame:(CGRect)arg1 {
original = self.frame;
-(void)layoutSubviews {
//%orig;

if(!self.hasKai) {
original = self.superview.superview.frame;
self.battery = [[KAIBattery alloc] initWithFrame:CGRectMake(8, 0, self.frame.size.width - 16, UIScreen.mainScreen.bounds.size.width)]; self.battery = [[KAIBattery alloc] initWithFrame:CGRectMake(8, 0, self.frame.size.width - 16, UIScreen.mainScreen.bounds.size.width)];
originalBattery = self.battery.frame; originalBattery = self.battery.frame;
[self addSubview:self.battery]; [self addSubview:self.battery];
setFrame = YES; setFrame = YES;
self.previousKaiCount = 0; self.previousKaiCount = 0;
self.hasKai = YES;
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(KaiUpdate) selector:@selector(KaiUpdate)
name:@"KaiInfoChanged" name:@"KaiInfoChanged"
object:nil]; object:nil];

//[self KaiUpdate];
[self.battery darkLightMode]; [self.battery darkLightMode];
}
[self KaiUpdate];


return %orig; return %orig;
} }
-(void)KaiUpdate { -(void)KaiUpdate {
if(self.battery) { if(self.battery) {


[self.battery updateBattery];
[self.battery updateBattery];

dispatch_async(dispatch_get_main_queue(), ^{


dispatch_async(dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.3 animations:^{


[UIView animateWithDuration:0.3 animations:^{
//self.translatesAutoresizingMaskIntoConstraints = NO;
// [self.topAnchor constraintEqualToAnchor:self.superview.topAnchor constant:(self.battery.number * 85)].active = YES;


self.translatesAutoresizingMaskIntoConstraints = NO;
[self.topAnchor constraintEqualToAnchor:self.superview.topAnchor constant:(self.battery.number * 85)].active = YES;
self.superview.superview.frame = CGRectMake(
original.origin.x,
original.origin.y + (self.battery.number * 85),
original.size.width,
original.size.height
);


self.battery.frame = CGRectMake(
originalBattery.origin.x,
originalBattery.origin.y - (self.battery.number * 85),
originalBattery.size.width,
originalBattery.size.height
);
}];
[self.battery darkLightMode];
});
/*self.battery.frame = CGRectMake(
originalBattery.origin.x,
originalBattery.origin.y - (self.battery.number * 85),
originalBattery.size.width,
originalBattery.size.height
);*/
}];
[self.battery darkLightMode];
});


} }
} }

Loading…
Cancel
Save