更新为Xcode 8 beta和ios 10 Beta后,循环UIImageView变化缓慢

时间:2016-06-19 02:33:39

标签: ios objective-c xcode uitableview uiimageview

我在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;
            });
        }];

0 个答案:

没有答案