|
|
|
|
|
|
|
|
if([devices count]!=0) { |
|
|
if([devices count]!=0) { |
|
|
//NSLog(@"kai: info is good, will proceed"); |
|
|
//NSLog(@"kai: info is good, will proceed"); |
|
|
|
|
|
|
|
|
|
|
|
__block float ytwo = 0; |
|
|
|
|
|
|
|
|
for(KAIBatteryCell *cell in self.subviews) { |
|
|
for(KAIBatteryCell *cell in self.subviews) { |
|
|
if([cell respondsToSelector:@selector(updateInfo)] && ![devices containsObject:cell.device]) { //to confirm is a cell and battery device does not exist |
|
|
if([cell respondsToSelector:@selector(updateInfo)] && ![devices containsObject:cell.device]) { //to confirm is a cell and battery device does not exist |
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
[cell removeFromSuperview]; |
|
|
[cell removeFromSuperview]; |
|
|
}); |
|
|
}); |
|
|
} else if([cell respondsToSelector:@selector(updateInfo)]) { |
|
|
} else if([cell respondsToSelector:@selector(updateInfo)]) { |
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
|
|
|
|
|
cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); |
|
|
[cell updateInfo]; |
|
|
[cell updateInfo]; |
|
|
}); |
|
|
|
|
|
|
|
|
ytwo+= bannerHeight + spacing; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
KAIBatteryCell *cell = [KAIBatteryCell cellForDeviceIfExists:device frameToCreateNew:CGRectMake(0, y, self.frame.size.width, bannerHeight)]; |
|
|
KAIBatteryCell *cell = [KAIBatteryCell cellForDeviceIfExists:device frameToCreateNew:CGRectMake(0, y, self.frame.size.width, bannerHeight)]; |
|
|
|
|
|
cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); |
|
|
|
|
|
|
|
|
if(cell) { |
|
|
if(cell) { |
|
|
cell.device = device; |
|
|
cell.device = device; |
|
|
cell.frame = cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); //bro im like creating my own stack view |
|
|
|
|
|
|
|
|
//cell.frame = cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); //bro im like creating my own stack view |
|
|
//[cell updateInfo]; |
|
|
//[cell updateInfo]; |
|
|
} |
|
|
} |
|
|
|
|
|
|