- (NSString *)netStatChangeBytes:(long )bytes {
if (bytes <= 0) {
return [NSString stringWithFormat:@"網速:0B..."];
}
if (bytes < 1024) { //B
return [NSString stringWithFormat:@"網速:%ldB",bytes];
}else if (bytes >= 1024 && bytes < 1024 *1024){//KB
return [NSString stringWithFormat:@"網速:%.1fkb",(double)bytes/1024];
}else if (bytes >= 1024 * 1024 && bytes < 1024 * 1024 * 1024) { //MB
return [NSString stringWithFormat:@"網速:%.1fMB",(double)bytes/(1024 * 1024)];
}else { //GB
return [NSString stringWithFormat:@"網速:%.1fGB",(double)bytes/(1024 * 1024 * 1024)];
}
}