我在uitableview中有一个UIImageView,在升级之前看起来很好,但现在却没有,需要一两秒钟从正方形转到圆圈。
cell.logo.layer.cornerRadius = cell.companyLogo.frame.size.width / 2;
cell.logo.clipsToBounds = YES;
更新
PFUser *user = [object objectForKey:@"userTookPhoto"];
cell.logo.file = (PFFile *)user[@"profileImage"];
[cell.logo loadInBackground:^(UIImage * _Nullable image, NSError * _Nullable error) {
cell.logo.layer.cornerRadius = cell.companyLogo.frame.size.width / 2;
cell.logo.clipsToBounds = YES;
}];
更新2
我最终做到了这一点,似乎更加顺畅。没有更多的延迟。
cell.logo.file = (PFFile *)searchedObject[@"profileImage"];
[cell.logo loadInBackground:^(UIImage * _Nullable image, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
//Code here to which needs to update the UI in the UI thread goes here
cell.logo.layer.cornerRadius = cell.logo.frame.size.width / 2;
cell.logo.clipsToBounds = YES;
});
}];