修复了房间返回按钮可能导致崩溃的问题
This commit is contained in:
@@ -300,14 +300,18 @@
|
|||||||
CGFloat scale = image.size.width / image.size.height;
|
CGFloat scale = image.size.width / image.size.height;
|
||||||
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
|
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
|
||||||
} else {
|
} else {
|
||||||
NSURL *imgUrl = [NSURL URLWithString:imageUrl];
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||||
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]];
|
NSURL *imgUrl = [NSURL URLWithString:imageUrl];
|
||||||
if (myImage) {
|
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]];
|
||||||
CGFloat scale = myImage.size.width / myImage.size.height;
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
|
if (myImage) {
|
||||||
} else {
|
CGFloat scale = myImage.size.width / myImage.size.height;
|
||||||
imageView.bounds = CGRectMake(0, 0, 20, 20);
|
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
|
||||||
}
|
} else {
|
||||||
|
imageView.bounds = CGRectMake(0, 0, 20, 20);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
imageView.layer.masksToBounds = YES;
|
imageView.layer.masksToBounds = YES;
|
||||||
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||||
|
@@ -1492,7 +1492,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
|
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
|
||||||
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
|
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
|
||||||
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
|
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
|
||||||
NSDictionary * dic = @{@"roomInfo":self.roomInfo.model2dictionary, @"userInfo":self.userInfo.model2dictionary, @"microQueue":self.getMicroQueue};
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
||||||
|
[dic safeSetObject:self.roomInfo.model2dictionary forKey:@"roomInfo"];
|
||||||
|
[dic safeSetObject:self.userInfo.model2dictionary forKey:@"userInfo"];
|
||||||
|
[dic safeSetObject:self.getMicroQueue forKey:@"microQueue"];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
|
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
|
||||||
[self.view endEditing:YES];
|
[self.view endEditing:YES];
|
||||||
[self.littleGameView handleSelfInExitEvent];
|
[self.littleGameView handleSelfInExitEvent];
|
||||||
@@ -1506,7 +1509,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
|
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
|
||||||
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
|
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
|
||||||
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
|
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
|
||||||
NSDictionary * dic = @{@"roomInfo":self.roomInfo.model2dictionary, @"userInfo":self.userInfo.model2dictionary, @"microQueue":self.getMicroQueue};
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
||||||
|
[dic safeSetObject:self.roomInfo.model2dictionary forKey:@"roomInfo"];
|
||||||
|
[dic safeSetObject:self.userInfo.model2dictionary forKey:@"userInfo"];
|
||||||
|
[dic safeSetObject:self.getMicroQueue forKey:@"microQueue"];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
|
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
|
||||||
[self.view endEditing:YES];
|
[self.view endEditing:YES];
|
||||||
[self.littleGameView handleSelfInExitEvent];
|
[self.littleGameView handleSelfInExitEvent];
|
||||||
@@ -1518,7 +1524,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
|||||||
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
|
[[XPRoomMiniManager shareManager] configRoomInfo:self.roomInfo];
|
||||||
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
|
[[XPRoomMiniManager shareManager] configUserInfo:self.userInfo];
|
||||||
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
|
[[XPRoomMiniManager shareManager] configCurrentMusic:self.functionView.getCurrentMusic isPlaying:self.functionView.isPlaying];
|
||||||
NSDictionary * dic = @{@"roomInfo":self.roomInfo.model2dictionary, @"userInfo":self.userInfo.model2dictionary, @"microQueue":self.getMicroQueue};
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
||||||
|
[dic safeSetObject:self.roomInfo.model2dictionary forKey:@"roomInfo"];
|
||||||
|
[dic safeSetObject:self.userInfo.model2dictionary forKey:@"userInfo"];
|
||||||
|
[dic safeSetObject:self.getMicroQueue forKey:@"microQueue"];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
|
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:nil userInfo:dic];
|
||||||
[self.view endEditing:YES];
|
[self.view endEditing:YES];
|
||||||
[self handleFirstOutRoom];
|
[self handleFirstOutRoom];
|
||||||
|
@@ -301,13 +301,16 @@ NSString * const kProhibitRightSlip = @"prohibitRightSlip";
|
|||||||
} else if ([message.name isEqualToString:kJSOpenRoom]) {
|
} else if ([message.name isEqualToString:kJSOpenRoom]) {
|
||||||
NSString *uid = [NSString stringWithFormat:@"%@",message.body];
|
NSString *uid = [NSString stringWithFormat:@"%@",message.body];
|
||||||
if (uid.length > 0) {
|
if (uid.length > 0) {
|
||||||
UIViewController * controller = [XCCurrentVCStackManager shareManager].getCurrentVC;
|
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
if ([controller isKindOfClass:[XPRoomViewController class]]) {
|
if ([obj isKindOfClass:[XPRoomViewController class]]) {
|
||||||
XPRoomViewController<RoomHostDelegate> * rooomVC = controller;
|
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController popToRootViewControllerAnimated:NO];
|
||||||
[rooomVC exitRoom];
|
XPRoomViewController<RoomHostDelegate> * rooomVC = obj;
|
||||||
[TTPopup dismiss];
|
[TTPopup dismiss];
|
||||||
}
|
[rooomVC exitRoom];
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
*stop = YES;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
[XPRoomViewController openRoom:uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
[XPRoomViewController openRoom:uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user