版本和自动刷新

This commit is contained in:
祝发冬 2022-11-08 09:59:58 +08:00
parent 9f58af5f9c
commit 296e93272b
2 changed files with 34 additions and 28 deletions

View File

@ -16025,7 +16025,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12; CURRENT_PROJECT_VERSION = 13;
DEVELOPMENT_TEAM = WFX8GD5HFX; DEVELOPMENT_TEAM = WFX8GD5HFX;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@ -16145,7 +16145,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 12; CURRENT_PROJECT_VERSION = 13;
DEVELOPMENT_TEAM = WFX8GD5HFX; DEVELOPMENT_TEAM = WFX8GD5HFX;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;

View File

@ -198,6 +198,7 @@
self.heartCount=0; self.heartCount=0;
} }
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refresh) name:UIApplicationDidBecomeActiveNotification object:nil];
} }
- (void)connect { - (void)connect {
@ -211,12 +212,19 @@
self.scrollview.delegate = self; self.scrollview.delegate = self;
__weak typeof (self)weakSelf=self; __weak typeof (self)weakSelf=self;
[weakSelf.scrollview addRefreshHeaderViewWithAniViewClass:[JHRefreshAmazingAniView class] beginRefresh:^{ [weakSelf.scrollview addRefreshHeaderViewWithAniViewClass:[JHRefreshAmazingAniView class] beginRefresh:^{
if (weakSelf.isRefeshing) {
[weakSelf refresh];
}];
}
-(void)refresh
{
if (self.isRefeshing) {
return ; return ;
} }
weakSelf.isRefeshing=YES; self.isRefeshing=YES;
if (weakSelf.isconnect) { if (self.isconnect) {
searchDeviceModel*xinxiModel=[[searchDeviceModel alloc]init]; searchDeviceModel*xinxiModel=[[searchDeviceModel alloc]init];
xinxiModel.resavemacId = self.currentDevice.macAddress; xinxiModel.resavemacId = self.currentDevice.macAddress;
xinxiModel.sendmacId = self.currentDevice.macAddress; xinxiModel.sendmacId = self.currentDevice.macAddress;
@ -229,16 +237,14 @@
}else{// socket }else{// socket
[[Socketsingleton sharedInstance] cutOffSocket]; [[Socketsingleton sharedInstance] cutOffSocket];
[weakSelf InitSocket]; [self InitSocket];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[weakSelf endRefreshing]; [self endRefreshing];
}); });
} }
}];
} }
-(void)endRefreshing{ -(void)endRefreshing{
if (self.isRefeshing) { if (self.isRefeshing) {
self.isRefeshing=NO; self.isRefeshing=NO;
@ -1261,7 +1267,7 @@
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
} }