mirror of
https://github.com/Burrit0z/kai
synced 2025-07-01 13:56:48 +00:00
its code
This commit is contained in:
28
Kai.xm
28
Kai.xm
@ -41,20 +41,25 @@ CGRect originalBattery;
|
|||||||
%property (nonatomic, assign) BOOL hasKai;
|
%property (nonatomic, assign) BOOL hasKai;
|
||||||
%property (nonatomic, assign) NSInteger previousKaiCount;
|
%property (nonatomic, assign) NSInteger previousKaiCount;
|
||||||
|
|
||||||
-(id)initWithFrame:(CGRect)arg1 {
|
-(void)layoutSubviews {
|
||||||
original = self.frame;
|
//%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;
|
||||||
}
|
}
|
||||||
@ -69,15 +74,22 @@ CGRect originalBattery;
|
|||||||
|
|
||||||
[UIView animateWithDuration:0.3 animations:^{
|
[UIView animateWithDuration:0.3 animations:^{
|
||||||
|
|
||||||
self.translatesAutoresizingMaskIntoConstraints = NO;
|
//self.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
[self.topAnchor constraintEqualToAnchor:self.superview.topAnchor constant:(self.battery.number * 85)].active = YES;
|
// [self.topAnchor constraintEqualToAnchor:self.superview.topAnchor constant:(self.battery.number * 85)].active = YES;
|
||||||
|
|
||||||
self.battery.frame = CGRectMake(
|
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.x,
|
||||||
originalBattery.origin.y - (self.battery.number * 85),
|
originalBattery.origin.y - (self.battery.number * 85),
|
||||||
originalBattery.size.width,
|
originalBattery.size.width,
|
||||||
originalBattery.size.height
|
originalBattery.size.height
|
||||||
);
|
);*/
|
||||||
}];
|
}];
|
||||||
[self.battery darkLightMode];
|
[self.battery darkLightMode];
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user