Commit 023cdbb6 by pidan

修改一些可能内存泄漏的点

parent 0306160c
...@@ -1196,9 +1196,9 @@ ...@@ -1196,9 +1196,9 @@
NSMutableAttributedString *contentAttr = [[NSMutableAttributedString alloc] init]; NSMutableAttributedString *contentAttr = [[NSMutableAttributedString alloc] init];
if (atAttr.length) { if (atAttr.length) {
[contentAttr appendAttributedString:atAttr]; [contentAttr appendAttributedString:atAttr];
[contentAttr appendAttributedString:[self createAttributedStringForString:@" : "]]; [contentAttr appendAttributedString:[weakSelf createAttributedStringForString:@" : "]];
} else if (bulletModel.barrageType == FUSbarrageTypeNormal) { } else if (bulletModel.barrageType == FUSbarrageTypeNormal) {
[nickNameAttr appendAttributedString:[self createAttributedStringForString:@" : "]]; [nickNameAttr appendAttributedString:[weakSelf createAttributedStringForString:@" : "]];
} }
[contentAttr appendAttributedString:bulletAttr]; [contentAttr appendAttributedString:bulletAttr];
...@@ -1519,6 +1519,7 @@ ...@@ -1519,6 +1519,7 @@
messageModel.realLevel = [jsonDict[@"user"][@"realLevel"] description]; messageModel.realLevel = [jsonDict[@"user"][@"realLevel"] description];
FUSLogVerbose(@"收到消息:%@", [messageModel fus_getDictionary]); FUSLogVerbose(@"收到消息:%@", [messageModel fus_getDictionary]);
// 解析出富文本 // 解析出富文本
[self transformModelIntoAttributedString:messageModel complete:^(NSMutableAttributedString *attr, CGRect rect) { [self transformModelIntoAttributedString:messageModel complete:^(NSMutableAttributedString *attr, CGRect rect) {
...@@ -1756,11 +1757,10 @@ ...@@ -1756,11 +1757,10 @@
- (void)fus_updateMessageWithModel:(FUSLiveChatModel *)model{ - (void)fus_updateMessageWithModel:(FUSLiveChatModel *)model{
__weak typeof(self) weakSelf = self;
for (int i = 0; i < _dataSource.count; i++) { for (int i = 0; i < _dataSource.count; i++) {
FUSLiveChatModel *objModel = [_dataSource objectAtIndex:i]; FUSLiveChatModel *objModel = [_dataSource objectAtIndex:i];
if ([model.ID isEqualToString:objModel.ID]) { if ([model.ID isEqualToString:objModel.ID]) {
__weak typeof(self) weakSelf = self;
[self transformModelIntoAttributedString:model complete:^(NSMutableAttributedString *attr, CGRect rect) { [self transformModelIntoAttributedString:model complete:^(NSMutableAttributedString *attr, CGRect rect) {
if (attr) [weakSelf.cellStringDict setObject:attr forKey:model.ID]; if (attr) [weakSelf.cellStringDict setObject:attr forKey:model.ID];
......
...@@ -838,10 +838,10 @@ UIGestureRecognizerDelegate ...@@ -838,10 +838,10 @@ UIGestureRecognizerDelegate
[FUSDeviceHelper fus_checkOldIPhoneDeviceHandler:^(BOOL oldDev) { [FUSDeviceHelper fus_checkOldIPhoneDeviceHandler:^(BOOL oldDev) {
if (oldDev) { if (oldDev) {
_chatBGImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, _chatViewBgView.y, UIView.fus_screenW, UIView.fus_screenH - _chatViewBgView.y)]; self.chatBGImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.chatViewBgView.y, UIView.fus_screenW, UIView.fus_screenH - _chatViewBgView.y)];
_chatBGImageView.image = [FUSShowRoomCenterBunble imageNamed:@"live_chat_tableView_bg"]; self.chatBGImageView.image = [FUSShowRoomCenterBunble imageNamed:@"live_chat_tableView_bg"];
_chatBGImageView.contentMode = UIViewContentModeScaleToFill; self.chatBGImageView.contentMode = UIViewContentModeScaleToFill;
[[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:_chatBGImageView]; [[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:self.chatBGImageView];
} }
}]; }];
......
...@@ -179,7 +179,7 @@ typedef enum : NSUInteger { ...@@ -179,7 +179,7 @@ typedef enum : NSUInteger {
- (FUSLHULDataUpdateFinishHandler)fus_updateUI { - (FUSLHULDataUpdateFinishHandler)fus_updateUI {
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
return ^(FUSLiveHeaderUserListChangedModel * _Nullable changedModel, void (^ _Nullable uireloadFinished)(void)) { return ^(FUSLiveHeaderUserListChangedModel * _Nullable changedModel, void (^ _Nullable uireloadFinished)(void)) {
[self.userCountBtn setTitle:@(weakSelf.userListViewModel.totalRealUserCount).stringValue forState:UIControlStateNormal]; [weakSelf.userCountBtn setTitle:@(weakSelf.userListViewModel.totalRealUserCount).stringValue forState:UIControlStateNormal];
if (changedModel == nil) { if (changedModel == nil) {
if (uireloadFinished) { if (uireloadFinished) {
uireloadFinished(); uireloadFinished();
......
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 sign in to comment