|
|
@@ -10,6 +10,10 @@
|
|
|
#include <sys/param.h>
|
|
|
|
|
|
@interface downloadFileBottomView ()
|
|
|
+{
|
|
|
+ long diskfreeSpace;//iphone 空间
|
|
|
+ BOOL isCanDown;
|
|
|
+}
|
|
|
@property(nonatomic,strong)UILabel *selectNumLabel;
|
|
|
@property(nonatomic,strong)UILabel *uploadFileRoutelabel;
|
|
|
@property(nonatomic,strong)UIButton *uploadButon;
|
|
|
@@ -31,11 +35,13 @@
|
|
|
unsigned long long freeSpace = -1;
|
|
|
if (statfs("/var", &buf) >= 0) {
|
|
|
freeSpace = (unsigned long long)(buf.f_bsize * buf.f_bavail);
|
|
|
+ diskfreeSpace = freeSpace;
|
|
|
}
|
|
|
NSString *str = [NSString stringWithFormat:@"%0.2f GB",freeSpace/1024.0/1024.0/1024.0];
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
- (void)drawAnyView{
|
|
|
_selectNumLabel = [[UILabel alloc] init];
|
|
|
_selectNumLabel.font = [UIFont boldSystemFontOfSize:16.0];
|
|
|
@@ -111,6 +117,7 @@
|
|
|
#pragma mark 数据处理
|
|
|
- (void)setIndexPathsForSelectedItems:(NSMutableArray *)indexPathsForSelectedItems
|
|
|
{
|
|
|
+ isCanDown = YES;
|
|
|
|
|
|
_indexPathsForSelectedItems = indexPathsForSelectedItems;
|
|
|
if(!_indexPathsForSelectedItems){
|
|
|
@@ -126,6 +133,10 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if(diskfreeSpace < allImageData){
|
|
|
+ isCanDown = NO;
|
|
|
+ }
|
|
|
+
|
|
|
allImageData /= 1024;
|
|
|
|
|
|
NSString *byteStr = nil;
|
|
|
@@ -154,7 +165,13 @@
|
|
|
NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
|
|
|
|
|
|
NSRange redRange = NSMakeRange([totalStr rangeOfString:curStr2].location, [totalStr rangeOfString:curStr2].length);
|
|
|
- [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#959799" alpha:1.0] range:redRange];
|
|
|
+
|
|
|
+ UIColor *noteColor =[UIColor hwColor:@"#959799" alpha:1.0];
|
|
|
+ if(!isCanDown){
|
|
|
+ noteColor = [UIColor redColor];
|
|
|
+ }
|
|
|
+
|
|
|
+ [noteStr addAttribute:NSForegroundColorAttributeName value:noteColor range:redRange];
|
|
|
[noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14.0] range:redRange];
|
|
|
// 设置行间距
|
|
|
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
|
@@ -164,7 +181,7 @@
|
|
|
|
|
|
_selectNumLabel.attributedText = noteStr;
|
|
|
|
|
|
- if(_indexPathsForSelectedItems.count > 0){
|
|
|
+ if(_indexPathsForSelectedItems.count > 0 && isCanDown){
|
|
|
self.uploadButon.enabled = YES;
|
|
|
self.uploadButon.alpha = 1;
|
|
|
}
|