Created
November 24, 2017 14:29
-
-
Save Superbil/30daa2afb03cc0ca0b32dc8d382f9942 to your computer and use it in GitHub Desktop.
大概是真的不懂 block 的人會才這樣寫
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{ | |
[[APIManager sharedInstance] fetchMasterInfoWith:_user.ID success:^(MasterInfo *masterInfo) { | |
self.lblDesc.text = masterInfo.desc; | |
data_done= TRUE; | |
} failure:^(NSError *error) { | |
data_done= TRUE; | |
}]; | |
while (true) { | |
if ( data_done ) { | |
break; | |
} | |
usleep(500); | |
} | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self.imgAvatar setImageWithURL: [NSURL URLWithString:_user.profileThumbPicture]]; | |
[self.imgAvatar sizeToFit]; | |
CALayer *imageLayer = self.imgAvatar.layer; | |
[imageLayer setCornerRadius:self.imgAvatar.frame.size.width/2]; | |
[imageLayer setBorderWidth:1]; | |
[imageLayer setMasksToBounds:YES]; | |
self.lblBroadcaster.text = _user.nickName; | |
self.lblFansCount.text = [NSString stringWithFormat:@"%.6d", [_user.fansCount intValue]]; | |
self.lblHeartCount.text = [NSString stringWithFormat:@"%.6d", [_user.linkCount intValue]]; | |
self.lblFollowCount.text = [NSString stringWithFormat:@"%.6d", [_user.trackerCount intValue]]; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment