Commit 03ed62ea authored by 曹云霄's avatar 曹云霄

修复客户基于IOS10 的bug

parent be69cb93
...@@ -441,7 +441,7 @@ ...@@ -441,7 +441,7 @@
} WithprogressBlock:^(double progress) { } WithprogressBlock:^(double progress) {
if (progress >= 1) { if (progress >= 1) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
weskSelf.TCHud.label.text = @"上传完成"; weskSelf.TCHud.labelText = @"上传完成";
[weskSelf RemoveMBProgressHUDLoding]; [weskSelf RemoveMBProgressHUDLoding];
}); });
}else }else
...@@ -452,12 +452,12 @@ ...@@ -452,12 +452,12 @@
} }
} WithErrorCodeBlock:^(id errorCodeValue) { } WithErrorCodeBlock:^(id errorCodeValue) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
weskSelf.TCHud.label.text = @"上传失败"; weskSelf.TCHud.labelText = @"上传失败";
[weskSelf RemoveMBProgressHUDLoding]; [weskSelf RemoveMBProgressHUDLoding];
}); });
} WithFailureBlock:^(NSError *error) { } WithFailureBlock:^(NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
weskSelf.TCHud.label.text = @"上传失败"; weskSelf.TCHud.labelText = @"上传失败";
[weskSelf RemoveMBProgressHUDLoding]; [weskSelf RemoveMBProgressHUDLoding];
}); });
}]; }];
...@@ -597,7 +597,6 @@ ...@@ -597,7 +597,6 @@
[self ErrorMBProgressView:@"地址不能为空"]; [self ErrorMBProgressView:@"地址不能为空"];
return; return;
} }
//客户信息类 //客户信息类
MyclientEntityModel *customerEntity = [[MyclientEntityModel alloc]init]; MyclientEntityModel *customerEntity = [[MyclientEntityModel alloc]init];
customerEntity.createName = [Shoppersmanager manager].Shoppers.employee.realName; customerEntity.createName = [Shoppersmanager manager].Shoppers.employee.realName;
...@@ -610,53 +609,51 @@ ...@@ -610,53 +609,51 @@
if (isChange) { if (isChange) {
customerEntity.fid = [Customermanager manager].model.fid; customerEntity.fid = [Customermanager manager].model.fid;
} }
__weak typeof(self) weskSelf = self; WS(weakSelf);
[self CreateMBProgressHUDLoding]; [self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(ADDCONSUMER) WithRequestType:0 WithParameter:customerEntity WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(ADDCONSUMER) WithRequestType:0 WithParameter:customerEntity WithReturnValueBlock:^(id returnValue) {
[weskSelf RemoveMBProgressHUDLoding]; [weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
//进入刷新状态 //进入刷新状态
[weskSelf.informationTableview.mj_header beginRefreshing]; [weakSelf.informationTableview.mj_header beginRefreshing];
//新增保存ID //新增保存ID
if (!isChange) { if (!isChange) {
customerEntity.fid = returnValue[@"data"]; customerEntity.fid = returnValue[@"data"];
[Customermanager manager].model = customerEntity; [Customermanager manager].model = customerEntity;
[weskSelf SuccessMBProgressView:@"新增成功"]; [weakSelf SuccessMBProgressView:@"新增成功"];
[weskSelf addAddressInformationRequest]; [weakSelf addAddressInformationRequest];
}else }else
{ {
[weskSelf SuccessMBProgressView:@"修改成功"]; [weakSelf SuccessMBProgressView:@"修改成功"];
[weskSelf.changePersonInformationButton setTitle:@"更改客户信息" forState:UIControlStateNormal]; [weakSelf.changePersonInformationButton setTitle:@"更改客户信息" forState:UIControlStateNormal];
} }
//保存客户信息 //保存客户信息
[Customermanager manager].model = customerEntity; [Customermanager manager].model = customerEntity;
[Shoppersmanager manager].currentCustomer = YES; [Shoppersmanager manager].currentCustomer = YES;
[weskSelf.addpersonInformationButton setTitle:@"退出当前客户" forState:UIControlStateNormal]; [weakSelf.addpersonInformationButton setTitle:@"退出当前客户" forState:UIControlStateNormal];
weskSelf.changePersonInformationButton.hidden = NO; weakSelf.changePersonInformationButton.hidden = NO;
weskSelf.customerNameField.enabled = NO; weakSelf.customerNameField.enabled = NO;
weskSelf.customerAddress.enabled = NO; weakSelf.customerAddress.enabled = NO;
weskSelf.phoneNumberField.enabled = NO; weakSelf.phoneNumberField.enabled = NO;
weskSelf.companyNameField.enabled = NO; weakSelf.companyNameField.enabled = NO;
[weskSelf SetupUserShoppingCarNumberRequest]; [weakSelf SetupUserShoppingCarNumberRequest];
[weskSelf SetupUserRequest]; [weakSelf SetupUserRequest];
[weskSelf ChangeCustomerName]; [weakSelf ChangeCustomerName];
} }
else else
{ {
[weskSelf ErrorMBProgressView:returnValue[@"message"]]; [weakSelf ErrorMBProgressView:returnValue[@"message"]];
} }
} WithErrorCodeBlock:^(id errorCodeValue) { } WithErrorCodeBlock:^(id errorCodeValue) {
[weskSelf RemoveMBProgressHUDLoding]; [weakSelf RemoveMBProgressHUDLoding];
[weskSelf promptCustomerWithString:@"网络连接已断开"]; [weakSelf promptCustomerWithString:@"网络连接已断开"];
} WithFailureBlock:^(id error) { } WithFailureBlock:^(id error) {
[weakSelf RemoveMBProgressHUDLoding];
[weskSelf RemoveMBProgressHUDLoding];
}]; }];
} }
...@@ -695,10 +692,7 @@ ...@@ -695,10 +692,7 @@
#pragma mark -更改客户信息 #pragma mark -更改客户信息
- (IBAction)changeCustomerInformation:(UIButton *)sender { - (IBAction)changeCustomerInformation:(UIButton *)sender {
if ([sender.currentTitle isEqualToString:@"保存"]) { if ([sender.currentTitle isEqualToString:@"保存"]) {
[self.customerNameField resignFirstResponder]; [self.customerNameField resignFirstResponder];
[sender setTitle:@"更改客户信息" forState:UIControlStateNormal]; [sender setTitle:@"更改客户信息" forState:UIControlStateNormal];
[self addCustomerInformation:YES]; [self addCustomerInformation:YES];
...@@ -749,6 +743,10 @@ ...@@ -749,6 +743,10 @@
self.customerAddress.enabled = NO; self.customerAddress.enabled = NO;
self.phoneNumberField.enabled = NO; self.phoneNumberField.enabled = NO;
self.companyNameField.enabled = NO; self.companyNameField.enabled = NO;
self.customerNameField.text = [Customermanager manager].model.name;
self.customerAddress.text = [Customermanager manager].model.address;
self.phoneNumberField.text = [Customermanager manager].model.mobile;
self.companyNameField.text = [Customermanager manager].model.company;
[self.changePersonInformationButton setTitle:@"更改客户信息" forState:UIControlStateNormal]; [self.changePersonInformationButton setTitle:@"更改客户信息" forState:UIControlStateNormal];
} }
} }
......
...@@ -438,8 +438,10 @@ ...@@ -438,8 +438,10 @@
return; return;
} }
TOGoodsEntity *model = [weakSelf.datasArray objectAtIndex_opple:cellindex]; TOGoodsEntity *model = [weakSelf.datasArray objectAtIndex_opple:cellindex];
[weakSelf CreateMBProgressHUDLoding];
[weakSelf addGoodsShoppingbags:model complate:^{ [weakSelf addGoodsShoppingbags:model complate:^{
NSLog(@"加入购物车完成"); NSLog(@"加入购物车完成");
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf StartAddShoppingCarAnimationWithimage:weakCell.productImageView.image withStartpoint:centerPoint withSize:size]; [weakSelf StartAddShoppingCarAnimationWithimage:weakCell.productImageView.image withStartpoint:centerPoint withSize:size];
}]; }];
}]; }];
...@@ -672,13 +674,11 @@ ...@@ -672,13 +674,11 @@
condition.materialEqueals = materialCode; condition.materialEqueals = materialCode;
} }
if (![priceTitle isEqualToString:@"全部"]) { if (![priceTitle isEqualToString:@"全部"]) {
//价格字符串切割 //价格字符串切割
NSArray *spacrArray = [priceTitle componentsSeparatedByString:@"到"]; NSArray *spacrArray = [priceTitle componentsSeparatedByString:@"到"];
condition.startprice = [NSNumber numberWithInteger:[[spacrArray objectAtIndex_opple:0] integerValue]]; condition.startprice = [NSNumber numberWithInteger:[[spacrArray objectAtIndex_opple:0] integerValue]];
condition.endprice = [NSNumber numberWithInteger:[[spacrArray objectAtIndex_opple:1] integerValue]]; condition.endprice = [NSNumber numberWithInteger:[[spacrArray objectAtIndex_opple:1] integerValue]];
} }
self.condtionModel.styleEquals = condition.styleEquals; self.condtionModel.styleEquals = condition.styleEquals;
self.condtionModel.categoryEquals = condition.categoryEquals; self.condtionModel.categoryEquals = condition.categoryEquals;
self.condtionModel.spaceEquals = condition.spaceEquals; self.condtionModel.spaceEquals = condition.spaceEquals;
...@@ -686,12 +686,12 @@ ...@@ -686,12 +686,12 @@
self.condtionModel.startprice = condition.startprice; self.condtionModel.startprice = condition.startprice;
self.condtionModel.endprice = condition.endprice; self.condtionModel.endprice = condition.endprice;
self.selectedCode = nil;//清空单选 self.selectedCode = nil;//清空单选
__weak typeof (self) Weakself = self; WS(weakSelf);
[self getGoodsListdatas:condition returnResponse:^(GoodsResponse *response) { [self getGoodsListdatas:condition returnResponse:^(GoodsResponse *response) {
Weakself.screenSecondView.totalNumber = response.total; weakSelf.screenSecondView.totalNumber = response.total;
//临时保存 //临时保存
self.temporaryArray = response; weakSelf.temporaryArray = response;
}]; }];
} }
...@@ -739,25 +739,23 @@ ...@@ -739,25 +739,23 @@
#pragma mark -添加至购物车 #pragma mark -添加至购物车
- (void)addGoodsShoppingbags:(TOGoodsEntity *)model complate:(void(^)())response - (void)addGoodsShoppingbags:(TOGoodsEntity *)model complate:(void(^)())response
{ {
WS(weakSelf);
SaveShoppingCartRequest *shopCar = [[SaveShoppingCartRequest alloc]init]; SaveShoppingCartRequest *shopCar = [[SaveShoppingCartRequest alloc]init];
shopCar.consumerId = [Customermanager manager].model.fid; shopCar.consumerId = [Customermanager manager].model.fid;
shopCar.goodsId = model.fid; shopCar.goodsId = model.fid;
shopCar.count = @"1"; shopCar.count = @"1";
WS(weakSelf);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(ADDSHOPPINGBAG) WithRequestType:0 WithParameter:shopCar WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(ADDSHOPPINGBAG) WithRequestType:0 WithParameter:shopCar WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
response(); response();
}else }else
{ {
[weakSelf ErrorMBProgressView:returnValue[@"message"]]; [weakSelf ErrorMBProgressView:returnValue[@"message"]];
} }
} WithErrorCodeBlock:^(id errorCodeValue) { } WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf SHOWPrompttext:NETWORK];
} WithFailureBlock:^(id error) { } WithFailureBlock:^(id error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:@"加入购物车失败"]; [weakSelf ErrorMBProgressView:@"加入购物车失败"];
}]; }];
} }
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
return; return;
} }
goodsNumber --; goodsNumber --;
// self.goodsNumbersLabe.text = [NSString stringWithFormat:@"%ld",goodsNumber];
} }
break; break;
case 101://增加 case 101://增加
...@@ -75,7 +74,6 @@ ...@@ -75,7 +74,6 @@
return; return;
} }
goodsNumber ++; goodsNumber ++;
// self.goodsNumbersLabe.text = [NSString stringWithFormat:@"%ld",goodsNumber];
} }
break; break;
default: default:
...@@ -83,12 +81,12 @@ ...@@ -83,12 +81,12 @@
} }
//改变价格 //改变价格
WS(weakSelf); WS(weakSelf);
self.productPriceLabe.text = [NSString stringWithFormat:@"¥%.2f",[self.goodsNumbersLabe.text integerValue]*[self.clinchTextfield.text floatValue]];
if ([self.delegate respondsToSelector:@selector(ChangeGoodsNumber:WithcostPrice:Withcellindex:returnValue:)]) { if ([self.delegate respondsToSelector:@selector(ChangeGoodsNumber:WithcostPrice:Withcellindex:returnValue:)]) {
[self.delegate ChangeGoodsNumber:goodsNumber WithcostPrice:[self.clinchTextfield.text floatValue]Withcellindex:_cellindex returnValue:^(id value) { [self.delegate ChangeGoodsNumber:goodsNumber WithcostPrice:[self.clinchTextfield.text floatValue]Withcellindex:_cellindex returnValue:^(id value) {
if ([value isKindOfClass:[NSDictionary class]]) { if ([value isKindOfClass:[NSDictionary class]]) {
if ([value[@"code"] isEqualToNumber:@0]) { if ([value[@"code"] isEqualToNumber:@0]) {
weakSelf.goodsNumbersLabe.text = [NSString stringWithFormat:@"%ld",goodsNumber]; weakSelf.goodsNumbersLabe.text = [NSString stringWithFormat:@"%ld",goodsNumber];
weakSelf.productPriceLabe.text = [NSString stringWithFormat:@"¥%.2f",[self.goodsNumbersLabe.text integerValue]*[self.clinchTextfield.text floatValue]];
} }
} }
}]; }];
...@@ -111,11 +109,7 @@ ...@@ -111,11 +109,7 @@
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField - (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{ {
Shoppersmanager *user = [Shoppersmanager manager]; Shoppersmanager *user = [Shoppersmanager manager];
if (![self isPureInt:textField.text]) { if ([textField.text floatValue] < [user.Shoppers.lowestDiscount floatValue]/100 * [self.model.goods.tagPrice floatValue])
if (self.promptStringBlock) {
self.promptStringBlock(@"输入格式错误");
}
} else if ([textField.text floatValue] < [user.Shoppers.lowestDiscount floatValue]/100 * [self.model.goods.tagPrice floatValue])
{ {
if (self.promptStringBlock) { if (self.promptStringBlock) {
self.promptStringBlock(@"当前价格低于你的权限范围!"); self.promptStringBlock(@"当前价格低于你的权限范围!");
...@@ -134,14 +128,51 @@ ...@@ -134,14 +128,51 @@
return YES; return YES;
} }
#pragma mark - <UITextFieldDelegate>
#pragma mark - 判断是否是浮点数 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
- (BOOL)isPureInt:(NSString*)string{ {
NSScanner* scan = [NSScanner scannerWithString:string]; NSScanner *scanner = [NSScanner scannerWithString:string];
float val; NSCharacterSet *numbers;
return[scan scanFloat:&val] && [scan isAtEnd]; NSRange pointRange = [textField.text rangeOfString:@"."];
if ( (pointRange.length > 0) && (pointRange.location < range.location || pointRange.location > range.location + range.length) ){
numbers = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
}else{
numbers = [NSCharacterSet characterSetWithCharactersInString:@"0123456789."];
}
if ( [textField.text isEqualToString:@""] && [string isEqualToString:@"."] ){
return NO;
}
short remain = 2; //保留 number位小数
NSString *tempStr = [textField.text stringByAppendingString:string];
NSUInteger strlen = [tempStr length];
if(pointRange.length > 0 && pointRange.location > 0){ //判断输入框内是否含有“.”。
if([string isEqualToString:@"."]){ //当输入框内已经含有“.”时,如果再输入“.”则被视为无效。
return NO;
}
if(strlen > 0 && (strlen - pointRange.location) > remain+1){ //当输入框内已经含有“.”,当字符串长度减去小数点前面的字符串长度大于需要要保留的小数点位数,则视当次输入无效。
return NO;
}
}
NSRange zeroRange = [textField.text rangeOfString:@"0"];
if(zeroRange.length == 1 && zeroRange.location == 0){ //判断输入框第一个字符是否为“0”
if(![string isEqualToString:@"0"] && ![string isEqualToString:@"."] && [textField.text length] == 1){ //当输入框只有一个字符并且字符为“0”时,再输入不为“0”或者“.”的字符时,则将此输入替换输入框的这唯一字符。
textField.text = string;
return NO;
}else{
if(pointRange.length == 0 && pointRange.location > 0){ //当输入框第一个字符为“0”时,并且没有“.”字符时,如果当此输入的字符为“0”,则视当此输入无效。
if([string isEqualToString:@"0"]){
return NO;
}
}
}
}
NSString *buffer;
if ( ![scanner scanCharactersFromSet:numbers intoString:&buffer] && ([string length] != 0) ){
return NO;
}else{
return YES;
}
} }
@end @end
...@@ -166,14 +166,16 @@ ...@@ -166,14 +166,16 @@
cell.delegate = self; cell.delegate = self;
cell.cellindex = indexPath.row; cell.cellindex = indexPath.row;
//cell选中回调 //cell选中回调
__weak typeof(self) weakSelf = self; __weak typeof(cell) weakCell = cell;
WS(weakSelf);
[cell setReturnCellblock:^(NSInteger index) { [cell setReturnCellblock:^(NSInteger index) {
[weakSelf setSelectedButton:index]; [weakSelf setSelectedButton:index];
}]; }];
//提示框回调 //提示框回调
[cell setPromptStringBlock:^(NSString *string) { [cell setPromptStringBlock:^(NSString *string) {
[weakSelf ErrorMBProgressView:string]; [weakSelf SHOWPrompttext:string ComcpleteBlock:^{
[weakCell.clinchTextfield becomeFirstResponder];
}];
}]; }];
return cell; return cell;
} }
...@@ -360,6 +362,7 @@ ...@@ -360,6 +362,7 @@
//没有选中任何商品 //没有选中任何商品
if (codeArr.count == 0) { if (codeArr.count == 0) {
[self RemoveMBProgressHUDLoding]; [self RemoveMBProgressHUDLoding];
[self SHOWPrompttext:@"未选中商品"];
return; return;
} }
delecteGoods.cartIds = codeArr; delecteGoods.cartIds = codeArr;
...@@ -406,11 +409,9 @@ ...@@ -406,11 +409,9 @@
//保存商品数量 //保存商品数量
ShopcarModel *model = [self.shopResponseArray objectAtIndex_opple:cellindex]; ShopcarModel *model = [self.shopResponseArray objectAtIndex_opple:cellindex];
model.goodsNum = goodsNumber; model.goodsNum = goodsNumber;
// [self.shopResponseArray replaceObjectAtIndex:cellindex withObject:model];
//保存成交价格 //保存成交价格
ShopcarModel *Newmodel = [self.shopResponseArray objectAtIndex_opple:cellindex]; ShopcarModel *Newmodel = [self.shopResponseArray objectAtIndex_opple:cellindex];
Newmodel.costPrice = [NSNumber numberWithFloat:costprice]; Newmodel.costPrice = [NSNumber numberWithFloat:costprice];
// [self.shopResponseArray replaceObjectAtIndex:cellindex withObject:Newmodel];
//在服务器保存数量、成交价 //在服务器保存数量、成交价
//购物车ID //购物车ID
NSString *carid = [[self.shopResponseArray objectAtIndex_opple:cellindex] fid]; NSString *carid = [[self.shopResponseArray objectAtIndex_opple:cellindex] fid];
......
...@@ -205,14 +205,14 @@ ...@@ -205,14 +205,14 @@
if (![Shoppersmanager manager].currentCustomer) { if (![Shoppersmanager manager].currentCustomer) {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
hud.label.text = @"必须设置当前客户才能访问购物车"; hud.labelText = @"必须设置当前客户才能访问购物车";
hud.margin = 10.f; hud.margin = 10.f;
hud.bezelView.color = [UIColor whiteColor]; hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
hud.minSize = CGSizeMake(200, 50); hud.minSize = CGSizeMake(200, 50);
hud.animationType = MBProgressHUDAnimationZoom; hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeText; hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES; hud.removeFromSuperViewOnHide = YES;
[hud hideAnimated:YES afterDelay:1.0f]; [hud hide:YES afterDelay:1.0f];
}else }else
{ {
...@@ -346,14 +346,14 @@ ...@@ -346,14 +346,14 @@
if (![Shoppersmanager manager].currentCustomer) { if (![Shoppersmanager manager].currentCustomer) {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
hud.label.text = @"必须设置当前客户才能访问购物车"; hud.labelText = @"必须设置当前客户才能访问购物车";
hud.margin = 10.f; hud.margin = 10.f;
hud.bezelView.color = [UIColor whiteColor]; hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
hud.minSize = CGSizeMake(200, 50); hud.minSize = CGSizeMake(200, 50);
hud.animationType = MBProgressHUDAnimationZoom; hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeText; hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES; hud.removeFromSuperViewOnHide = YES;
[hud hideAnimated:YES afterDelay:1.0f]; [hud hide:YES afterDelay:1.0f];
}else }else
{ {
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
if (progress >= 1) { if (progress >= 1) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self.TCHud.label.text = @"上传完成"; self.TCHud.labelText = @"上传完成";
[self RemoveMBProgressHUDLoding]; [self RemoveMBProgressHUDLoding];
}); });
}else }else
...@@ -157,12 +157,12 @@ ...@@ -157,12 +157,12 @@
} }
} WithErrorCodeBlock:^(id errorCodeValue) { } WithErrorCodeBlock:^(id errorCodeValue) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self.TCHud.label.text = @"上传失败"; self.TCHud.labelText = @"上传失败";
[self RemoveMBProgressHUDLoding]; [self RemoveMBProgressHUDLoding];
}); });
} WithFailureBlock:^(NSError *error) { } WithFailureBlock:^(NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self.TCHud.label.text = @"上传失败"; self.TCHud.labelText = @"上传失败";
[self RemoveMBProgressHUDLoding]; [self RemoveMBProgressHUDLoding];
}); });
}]; }];
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<key>CFBundleName</key> <key>CFBundleName</key>
<string>欧立方</string> <string>欧立方</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.1.0</string> <string>1.1.1</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
<array> <array>
<dict> <dict>
......
...@@ -2056,21 +2056,21 @@ ...@@ -2056,21 +2056,21 @@
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="名称" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1Ax-ZU-BSA"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="名称" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1Ax-ZU-BSA">
<rect key="frame" x="105" y="8" width="173" height="20"/> <rect key="frame" x="105" y="8" width="173" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/> <fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="规格" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="GuM-D9-qK2"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="规格" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="GuM-D9-qK2">
<rect key="frame" x="105" y="29" width="173" height="20"/> <rect key="frame" x="105" y="29" width="173" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/> <fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="代码" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bLy-NR-CRc"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="代码" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bLy-NR-CRc">
<rect key="frame" x="105" y="50" width="173" height="20"/> <rect key="frame" x="105" y="50" width="173" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/> <fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
......
...@@ -20,7 +20,7 @@ PODS: ...@@ -20,7 +20,7 @@ PODS:
- IQKeyboardManager (4.0.6) - IQKeyboardManager (4.0.6)
- JSONModel (1.2.0) - JSONModel (1.2.0)
- Masonry (1.0.2) - Masonry (1.0.2)
- MBProgressHUD (1.0.0) - MBProgressHUD (0.9.2)
- MJExtension (3.0.13) - MJExtension (3.0.13)
- MJRefresh (3.1.12) - MJRefresh (3.1.12)
- MMDrawerController (0.6.0): - MMDrawerController (0.6.0):
...@@ -48,7 +48,7 @@ DEPENDENCIES: ...@@ -48,7 +48,7 @@ DEPENDENCIES:
- IQKeyboardManager - IQKeyboardManager
- JSONModel (~> 1.2.0) - JSONModel (~> 1.2.0)
- Masonry - Masonry
- MBProgressHUD - MBProgressHUD (~> 0.9.1)
- MJExtension - MJExtension
- MJRefresh - MJRefresh
- MMDrawerController - MMDrawerController
...@@ -63,7 +63,7 @@ SPEC CHECKSUMS: ...@@ -63,7 +63,7 @@ SPEC CHECKSUMS:
IQKeyboardManager: c52debb1967799ae7addb98eab0cf328083a874f IQKeyboardManager: c52debb1967799ae7addb98eab0cf328083a874f
JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e
MBProgressHUD: 4890f671c94e8a0f3cf959aa731e9de2f036d71a MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1
MJExtension: 5932755f451458eefa24239358817f8d291240c7 MJExtension: 5932755f451458eefa24239358817f8d291240c7
MJRefresh: b96cdb21c4aa75a7b07654311ab2f315c497e806 MJRefresh: b96cdb21c4aa75a7b07654311ab2f315c497e806
MMDrawerController: e3a54a5570388463ad3b36975251575b50c4e1a0 MMDrawerController: e3a54a5570388463ad3b36975251575b50c4e1a0
......
Copyright © 2009-2016 Matej Bukovinski Copyright (c) 2009-2015 Matej Bukovinski
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
This diff is collapsed.
This diff is collapsed.
# MBProgressHUD # MBProgressHUD [![Build Status](https://travis-ci.org/matej/MBProgressHUD.svg?branch=master)](https://travis-ci.org/matej/MBProgressHUD)
[![Build Status](https://travis-ci.org/matej/MBProgressHUD.svg?branch=master)](https://travis-ci.org/matej/MBProgressHUD) [![codecov.io](https://codecov.io/github/matej/MBProgressHUD/coverage.svg?branch=master)](https://codecov.io/github/matej/MBProgressHUD?branch=master) MBProgressHUD is an iOS drop-in class that displays a translucent HUD with an indicator and/or labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, private UIKit UIProgressHUD with some additional features.
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) [![CocoaPods compatible](https://img.shields.io/cocoapods/v/MBProgressHUD.svg?style=flat)](https://cocoapods.org/pods/MBProgressHUD) [![License: MIT](https://img.shields.io/cocoapods/l/MBProgressHUD.svg?style=flat)](http://opensource.org/licenses/MIT)
`MBProgressHUD` is an iOS drop-in class that displays a translucent HUD with an indicator and/or labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, private `UIKit` `UIProgressHUD` with some additional features. [![](http://dl.dropbox.com/u/378729/MBProgressHUD/1-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/1.png)
[![](http://dl.dropbox.com/u/378729/MBProgressHUD/2-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/2.png)
[![](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/1-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/1.png) [![](http://dl.dropbox.com/u/378729/MBProgressHUD/3-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/3.png)
[![](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/2-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/2.png) [![](http://dl.dropbox.com/u/378729/MBProgressHUD/4-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/4.png)
[![](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/3-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/3.png) [![](http://dl.dropbox.com/u/378729/MBProgressHUD/5-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/5.png)
[![](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/4-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/4.png) [![](http://dl.dropbox.com/u/378729/MBProgressHUD/6-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/6.png)
[![](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/5-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/5.png) [![](http://dl.dropbox.com/u/378729/MBProgressHUD/7-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/7.png)
[![](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/6-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/6.png)
[![](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/7-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/v1/7.png)
**NOTE:** The class has recently undegone a major rewrite. The old version is available in the [legacy](https://github.com/jdg/MBProgressHUD/tree/legacy) branch, should you need it.
## Requirements ## Requirements
`MBProgressHUD` works on iOS 6+ and requires ARC to build. It depends on the following Apple frameworks, which should already be included with most Xcode templates: MBProgressHUD works on any iOS version and is compatible with both ARC and non-ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates:
* Foundation.framework * Foundation.framework
* UIKit.framework * UIKit.framework
* CoreGraphics.framework * CoreGraphics.framework
You will need the latest developer tools in order to build `MBProgressHUD`. Old Xcode versions might work, but compatibility will not be explicitly maintained. You will need the latest developer tools in order to build MBProgressHUD. Old Xcode versions might work, but compatibility will not be explicitly maintained.
## Adding MBProgressHUD to your project ## Adding MBProgressHUD to your project
### CocoaPods ### Cocoapods
[CocoaPods](http://cocoapods.org) is the recommended way to add MBProgressHUD to your project. [CocoaPods](http://cocoapods.org) is the recommended way to add MBProgressHUD to your project.
1. Add a pod entry for MBProgressHUD to your Podfile `pod 'MBProgressHUD', '~> 1.0.0'` 1. Add a pod entry for MBProgressHUD to your Podfile `pod 'MBProgressHUD', '~> 0.9.2'`
2. Install the pod(s) by running `pod install`. 2. Install the pod(s) by running `pod install`.
3. Include MBProgressHUD wherever you need it with `#import "MBProgressHUD.h"`. 3. Include MBProgressHUD wherever you need it with `#import "MBProgressHUD.h"`.
### Carthage
1. Add MBProgressHUD to your Cartfile. e.g., `github "jdg/MBProgressHUD" ~> 1.0.0`
2. Run `carthage update`
3. Follow the rest of the [standard Carthage installation instructions](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) to add MBProgressHUD to your project.
### Source files ### Source files
Alternatively you can directly add the `MBProgressHUD.h` and `MBProgressHUD.m` source files to your project. Alternatively you can directly add the `MBProgressHUD.h` and `MBProgressHUD.m` source files to your project.
...@@ -72,8 +61,6 @@ dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ ...@@ -72,8 +61,6 @@ dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
}); });
``` ```
You can add the HUD on any view or window. It is however a good idea to avoid adding the HUD to certain `UIKit` views with complex view hierarchies - like `UITableView` or `UICollectionView`. Those can mutate their subviews in unexpected ways and thereby break HUD display.
If you need to configure the HUD you can do this by using the MBProgressHUD reference that showHUDAddedTo:animated: returns. If you need to configure the HUD you can do this by using the MBProgressHUD reference that showHUDAddedTo:animated: returns.
```objective-c ```objective-c
...@@ -87,18 +74,6 @@ hud.labelText = @"Loading"; ...@@ -87,18 +74,6 @@ hud.labelText = @"Loading";
}]; }];
``` ```
You can also use a `NSProgress` object and MBProgressHUD will update itself when there is progress reported through that object.
```objective-c
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeAnnularDeterminate;
hud.labelText = @"Loading";
NSProgress *progress = [self doSomethingInBackgroundCompletion:^{
[hud hide:YES];
}];
hud.progressObject = progress;
```
UI updates should always be done on the main thread. Some MBProgressHUD setters are however considered "thread safe" and can be called from background threads. Those also include `setMode:`, `setCustomView:`, `setLabelText:`, `setLabelFont:`, `setDetailsLabelText:`, `setDetailsLabelFont:` and `setProgress:`. UI updates should always be done on the main thread. Some MBProgressHUD setters are however considered "thread safe" and can be called from background threads. Those also include `setMode:`, `setCustomView:`, `setLabelText:`, `setLabelFont:`, `setDetailsLabelText:`, `setDetailsLabelFont:` and `setProgress:`.
If you need to run your long-running task in the main thread, you should perform it with a slight delay, so UIKit will have enough time to update the UI (i.e., draw the HUD) before you block the main thread with your task. If you need to run your long-running task in the main thread, you should perform it with a slight delay, so UIKit will have enough time to update the UI (i.e., draw the HUD) before you block the main thread with your task.
...@@ -123,4 +98,4 @@ This code is distributed under the terms and conditions of the [MIT license](LIC ...@@ -123,4 +98,4 @@ This code is distributed under the terms and conditions of the [MIT license](LIC
## Change-log ## Change-log
A brief summary of each MBProgressHUD release can be found in the [CHANGELOG](CHANGELOG.mdown). A brief summary of each MBProgressHUD release can be found on the [wiki](https://github.com/matej/MBProgressHUD/wiki/Change-log).
...@@ -20,7 +20,7 @@ PODS: ...@@ -20,7 +20,7 @@ PODS:
- IQKeyboardManager (4.0.6) - IQKeyboardManager (4.0.6)
- JSONModel (1.2.0) - JSONModel (1.2.0)
- Masonry (1.0.2) - Masonry (1.0.2)
- MBProgressHUD (1.0.0) - MBProgressHUD (0.9.2)
- MJExtension (3.0.13) - MJExtension (3.0.13)
- MJRefresh (3.1.12) - MJRefresh (3.1.12)
- MMDrawerController (0.6.0): - MMDrawerController (0.6.0):
...@@ -48,7 +48,7 @@ DEPENDENCIES: ...@@ -48,7 +48,7 @@ DEPENDENCIES:
- IQKeyboardManager - IQKeyboardManager
- JSONModel (~> 1.2.0) - JSONModel (~> 1.2.0)
- Masonry - Masonry
- MBProgressHUD - MBProgressHUD (~> 0.9.1)
- MJExtension - MJExtension
- MJRefresh - MJRefresh
- MMDrawerController - MMDrawerController
...@@ -63,7 +63,7 @@ SPEC CHECKSUMS: ...@@ -63,7 +63,7 @@ SPEC CHECKSUMS:
IQKeyboardManager: c52debb1967799ae7addb98eab0cf328083a874f IQKeyboardManager: c52debb1967799ae7addb98eab0cf328083a874f
JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e
MBProgressHUD: 4890f671c94e8a0f3cf959aa731e9de2f036d71a MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1
MJExtension: 5932755f451458eefa24239358817f8d291240c7 MJExtension: 5932755f451458eefa24239358817f8d291240c7
MJRefresh: b96cdb21c4aa75a7b07654311ab2f315c497e806 MJRefresh: b96cdb21c4aa75a7b07654311ab2f315c497e806
MMDrawerController: e3a54a5570388463ad3b36975251575b50c4e1a0 MMDrawerController: e3a54a5570388463ad3b36975251575b50c4e1a0
......
This diff is collapsed.
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MBProgressHUD" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bugly" "${PODS_ROOT}/Headers/Public/DZNEmptyDataSet" "${PODS_ROOT}/Headers/Public/FDFullscreenPopGesture" "${PODS_ROOT}/Headers/Public/IQKeyboardManager" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/MMDrawerController" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/UMengSocial" HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MBProgressHUD" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/Bugly" "${PODS_ROOT}/Headers/Public/DZNEmptyDataSet" "${PODS_ROOT}/Headers/Public/FDFullscreenPopGesture" "${PODS_ROOT}/Headers/Public/IQKeyboardManager" "${PODS_ROOT}/Headers/Public/JSONModel" "${PODS_ROOT}/Headers/Public/MBProgressHUD" "${PODS_ROOT}/Headers/Public/MJExtension" "${PODS_ROOT}/Headers/Public/MJRefresh" "${PODS_ROOT}/Headers/Public/MMDrawerController" "${PODS_ROOT}/Headers/Public/Masonry" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/UMengSocial"
OTHER_LDFLAGS = -framework "CoreGraphics" -framework "QuartzCore" OTHER_LDFLAGS = -framework "CoreGraphics"
PODS_ROOT = ${SRCROOT} PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES SKIP_INSTALL = YES
\ No newline at end of file
...@@ -125,7 +125,7 @@ The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/M ...@@ -125,7 +125,7 @@ The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/M
## MBProgressHUD ## MBProgressHUD
Copyright © 2009-2016 Matej Bukovinski Copyright (c) 2009-2015 Matej Bukovinski
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
...@@ -160,7 +160,7 @@ The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/M ...@@ -160,7 +160,7 @@ The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/M
</dict> </dict>
<dict> <dict>
<key>FooterText</key> <key>FooterText</key>
<string>Copyright &#169; 2009-2016 Matej Bukovinski <string>Copyright (c) 2009-2015 Matej Bukovinski
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
{ {
if (_TCHud == nil) { if (_TCHud == nil) {
_TCHud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES]; _TCHud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
} }
return _TCHud; return _TCHud;
} }
...@@ -118,13 +118,13 @@ ...@@ -118,13 +118,13 @@
#pragma mark -渐隐提示框回调 #pragma mark -渐隐提示框回调
- (void)SHOWPrompttext:(NSString *)Text ComcpleteBlock:(void(^)())completed - (void)SHOWPrompttext:(NSString *)Text ComcpleteBlock:(void(^)())completed
{ {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
hud.label.text = Text; hud.labelText = Text;
hud.animationType = MBProgressHUDAnimationZoom; hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeText; hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES; hud.removeFromSuperViewOnHide = YES;
[hud hideAnimated:YES afterDelay:2.0]; [hud hide:YES afterDelay:1.0f];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (completed) { if (completed) {
completed(); completed();
} }
...@@ -136,8 +136,8 @@ ...@@ -136,8 +136,8 @@
{ {
self.TCHud.animationType = MBProgressHUDAnimationZoom; self.TCHud.animationType = MBProgressHUDAnimationZoom;
self.TCHud.mode = MBProgressHUDModeIndeterminate; self.TCHud.mode = MBProgressHUDModeIndeterminate;
self.TCHud.bezelView.color = [UIColor whiteColor]; self.TCHud.color = [UIColor clearColor];
self.TCHud.contentColor = kMainBlueColor; self.TCHud.activityIndicatorColor = kMainBlueColor;
self.TCHud.removeFromSuperViewOnHide = YES; self.TCHud.removeFromSuperViewOnHide = YES;
} }
...@@ -148,8 +148,8 @@ ...@@ -148,8 +148,8 @@
{ {
self.TCHud.mode = MBProgressHUDModeDeterminateHorizontalBar; self.TCHud.mode = MBProgressHUDModeDeterminateHorizontalBar;
self.TCHud.label.text = @"上传中...."; self.TCHud.labelText = @"上传中....";
self.TCHud.label.font = [UIFont systemFontOfSize:12]; self.TCHud.labelFont = [UIFont systemFontOfSize:12];
self.TCHud.progress = progress; self.TCHud.progress = progress;
self.TCHud.removeFromSuperViewOnHide = YES; self.TCHud.removeFromSuperViewOnHide = YES;
} }
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
#pragma mark -移除MBProgressHUD等待视图 #pragma mark -移除MBProgressHUD等待视图
- (void)RemoveMBProgressHUDLoding; - (void)RemoveMBProgressHUDLoding;
{ {
[_TCHud hideAnimated:YES]; [_TCHud hide:YES];
_TCHud = nil; _TCHud = nil;
} }
...@@ -165,28 +165,28 @@ ...@@ -165,28 +165,28 @@
#pragma mark -显示成功的提示框 #pragma mark -显示成功的提示框
- (void)SuccessMBProgressView:(NSString *)successString - (void)SuccessMBProgressView:(NSString *)successString
{ {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
hud.mode = MBProgressHUDModeCustomView; hud.mode = MBProgressHUDModeCustomView;
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
hud.customView = [[UIImageView alloc] initWithImage:image]; hud.customView = [[UIImageView alloc] initWithImage:image];
hud.bezelView.color = [UIColor whiteColor]; hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.6];
hud.label.font = [UIFont systemFontOfSize:12]; hud.labelFont = [UIFont systemFontOfSize:12];
hud.label.text = successString; hud.labelText = successString;
[hud hideAnimated:YES afterDelay:1.0]; [hud hide:YES afterDelay:1];
} }
#pragma mark -显示信息的提示框 #pragma mark -显示信息的提示框
- (void)ErrorMBProgressView:(NSString *)errorString - (void)ErrorMBProgressView:(NSString *)errorString
{ {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.label.text = errorString; hud.labelText = errorString;
hud.margin = 10.f; hud.margin = 10.f;
hud.bezelView.color = [UIColor whiteColor]; hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
hud.minSize = CGSizeMake(250, 70); hud.minSize = CGSizeMake(250, 70);
hud.animationType = MBProgressHUDAnimationZoom; hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeText; hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES; hud.removeFromSuperViewOnHide = YES;
[hud hideAnimated:YES afterDelay:1.0f]; [hud hide:YES afterDelay:1.0f];
} }
...@@ -194,15 +194,15 @@ ...@@ -194,15 +194,15 @@
#pragma mark -渐隐提示框 #pragma mark -渐隐提示框
- (void)SHOWPrompttext:(NSString *)Text - (void)SHOWPrompttext:(NSString *)Text
{ {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.label.text = Text; hud.labelText = Text;
hud.margin = 10.f; hud.margin = 10.f;
hud.bezelView.color = [UIColor whiteColor]; hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
hud.minSize = CGSizeMake(200, 50); hud.minSize = CGSizeMake(200, 50);
hud.animationType = MBProgressHUDAnimationZoom; hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeText; hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES; hud.removeFromSuperViewOnHide = YES;
[hud hideAnimated:YES afterDelay:1.0f]; [hud hide:YES afterDelay:1.0f];
} }
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
#pragma mark 调用airPrint无线打印机 #pragma mark 调用airPrint无线打印机
- (void)callAirprintWithURL:(NSURL *)datasurl SuccessBlock:(void (^)())success ErrorBlock:(void (^)())failed - (void)callAirprintWithURL:(NSURL *)datasurl SuccessBlock:(void (^)())success ErrorBlock:(void (^)())failed
{ {
// NSData *mypdfdata = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"The Swift Programming Language 中文版 - v1.2" ofType:@"pdf"]]; // NSData *mypdfdata = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"The Swift Programming Language 中文版 - v1.2" ofType:@"pdf"]];
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
......
...@@ -578,7 +578,7 @@ ...@@ -578,7 +578,7 @@
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self.TCHud.label.text = @"上传完成"; self.TCHud.labelText = @"上传完成";
[self RemoveMBProgressHUDLoding]; [self RemoveMBProgressHUDLoding];
}); });
} }
...@@ -588,7 +588,7 @@ ...@@ -588,7 +588,7 @@
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self.TCHud.label.text = @"上传失败"; self.TCHud.labelText = @"上传失败";
[self RemoveMBProgressHUDLoding]; [self RemoveMBProgressHUDLoding];
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment