|
|
@@ -8,7 +8,8 @@
|
|
|
#import "uploadFileRecordCell.h"
|
|
|
@interface uploadFileRecordCell ()
|
|
|
@property(nonatomic,strong) UIImageView *fileImageView;
|
|
|
-@property(nonatomic,strong) UIImageView *upLoadStateImageView;
|
|
|
+@property(nonatomic,strong) UIButton *upLoadStateButton;
|
|
|
+
|
|
|
@property (nonatomic, strong) UIButton *selectButton;
|
|
|
|
|
|
@property(nonatomic,strong) UIView *progressBgView;
|
|
|
@@ -47,14 +48,15 @@
|
|
|
make.bottom.mas_equalTo(-18);
|
|
|
}];
|
|
|
|
|
|
- _upLoadStateImageView = [[UIImageView alloc] init];
|
|
|
- //_upLoadStateImageView.backgroundColor = [UIColor redColor];
|
|
|
- [self.contentView addSubview:_upLoadStateImageView];
|
|
|
+ _upLoadStateButton = [[UIButton alloc] init];
|
|
|
+ //_upLoadStateButton.backgroundColor = [UIColor redColor];
|
|
|
+ [self.contentView addSubview:_upLoadStateButton];
|
|
|
+ [_upLoadStateButton addTarget:self action:@selector(tapClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
|
- [_upLoadStateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.mas_equalTo(-15);
|
|
|
- make.width.mas_equalTo(34);
|
|
|
- make.height.mas_equalTo(34);
|
|
|
+ [_upLoadStateButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_equalTo(-5);
|
|
|
+ make.width.mas_equalTo(50);
|
|
|
+ make.height.mas_equalTo(50);
|
|
|
make.bottom.mas_equalTo(-18);
|
|
|
}];
|
|
|
|
|
|
@@ -70,8 +72,8 @@
|
|
|
[but mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.width.mas_equalTo(30);
|
|
|
make.height.mas_equalTo(30);
|
|
|
- make.centerX.mas_equalTo(_upLoadStateImageView.mas_centerX);
|
|
|
- make.centerY.mas_equalTo(_upLoadStateImageView.mas_centerY);
|
|
|
+ make.centerX.mas_equalTo(_upLoadStateButton.mas_centerX);
|
|
|
+ make.centerY.mas_equalTo(_upLoadStateButton.mas_centerY);
|
|
|
}];
|
|
|
|
|
|
self.selectButton = but;
|
|
|
@@ -85,7 +87,7 @@
|
|
|
|
|
|
[_progressBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
|
|
|
- make.right.mas_equalTo(_upLoadStateImageView.mas_left).offset(-10);
|
|
|
+ make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
|
|
|
make.height.mas_equalTo(2);
|
|
|
make.centerY.mas_equalTo(0);
|
|
|
}];
|
|
|
@@ -122,7 +124,7 @@
|
|
|
|
|
|
[_fileNamelabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
|
|
|
- make.right.mas_equalTo(_upLoadStateImageView.mas_left).offset(-10);
|
|
|
+ make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
|
|
|
make.height.mas_equalTo(19);
|
|
|
make.bottom.mas_equalTo(_progressBgView.mas_top).offset(-3);
|
|
|
}];
|
|
|
@@ -148,7 +150,7 @@
|
|
|
[self.contentView addSubview:_fileSpeedlabel];
|
|
|
|
|
|
[_fileSpeedlabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.mas_equalTo(_upLoadStateImageView.mas_left).offset(-10);
|
|
|
+ make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
|
|
|
make.left.mas_equalTo(_progressBgView.mas_centerX);
|
|
|
make.height.mas_equalTo(15);
|
|
|
make.top.mas_equalTo(_progressBgView.mas_bottom).offset(3);
|
|
|
@@ -192,23 +194,27 @@
|
|
|
|
|
|
- (void)setCurUploadFileDataModel:(uploadFileDataModel *)curUploadFileDataModel
|
|
|
{
|
|
|
+ _curUploadFileDataModel = curUploadFileDataModel;
|
|
|
//HLog(@"hhhhhhh %@ %ld %ld",curUploadFileDataModel.bg_id,curUploadFileDataModel.curUploadStateType,curUploadFileDataModel.didUploadBytes);
|
|
|
|
|
|
_fileImageView.image = [UIImage imageWithData:curUploadFileDataModel.imageData];
|
|
|
_fileSpeedlabel.hidden = YES;
|
|
|
|
|
|
if(curUploadFileDataModel.curUploadStateType == uploadStateWait){
|
|
|
- _upLoadStateImageView.image = [UIImage imageNamed:@"uploadFile_wait"];
|
|
|
+ //_upLoadStateButton.image = [UIImage imageNamed:@"uploadFile_wait"];
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_wait"] forState:UIControlStateNormal];
|
|
|
}
|
|
|
else if(curUploadFileDataModel.curUploadStateType == uploadStateUploading){
|
|
|
- _upLoadStateImageView.image = [UIImage imageNamed:@"uploadFile_suspend"];
|
|
|
+ //_upLoadStateButton.image = [UIImage imageNamed:@"uploadFile_suspend"];
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
|
|
|
_fileSpeedlabel.hidden = NO;
|
|
|
}
|
|
|
else if(curUploadFileDataModel.curUploadStateType == uploadStateSuspend){
|
|
|
- _upLoadStateImageView.image = [UIImage imageNamed:@"uploadFile_start"];
|
|
|
+ //_upLoadStateButton.image = [UIImage imageNamed:@"uploadFile_start"];
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
|
|
|
}
|
|
|
else{
|
|
|
- _upLoadStateImageView.hidden = YES;
|
|
|
+ _upLoadStateButton.hidden = YES;
|
|
|
_progressBgView.hidden = YES;
|
|
|
}
|
|
|
|
|
|
@@ -224,6 +230,8 @@
|
|
|
|
|
|
CGFloat curProgress = curUploadFileDataModel.didUploadBytes/(totalSize*1.0);
|
|
|
|
|
|
+ HLog(@"hxdhxdddddddd %@ -- %f -- %ld",curUploadFileDataModel.bg_id,curProgress,curUploadFileDataModel.didUploadBytes );
|
|
|
+
|
|
|
if(curProgress > 1){
|
|
|
curProgress = 1;
|
|
|
}
|
|
|
@@ -294,4 +302,27 @@
|
|
|
_didClckSelectBut(but.selected);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+- (void)tapClick:(UIButton*)but{
|
|
|
+ if(_didTapPressClick){
|
|
|
+ _didTapPressClick();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(_curUploadFileDataModel.curUploadStateType == uploadStateUploading){
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(_curUploadFileDataModel.curUploadStateType == uploadStateSuspend){
|
|
|
+
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ but.userInteractionEnabled = NO;
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ but.userInteractionEnabled = YES;
|
|
|
+ });
|
|
|
+ HLog(@"hxdhxdddddddd");
|
|
|
+}
|
|
|
+
|
|
|
@end
|