私の最後の質問では、どのように円にするのだろうと思っていましたが、現在は円のサイズを変更しようとしています。なんらかの理由で、円は円として表示されません(それはそれが正方形であると表示されます)。私はそれをリフレッシュするためにそれをプルダウンし、それらのほとんどを正しく取得します。これは初めて正しくロードされませんが、リフレッシュ時に正しくロードされるのはなぜですか?
//-------------------------------------------------------------------------------------------------------------------------------------------------
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//-------------------------------------------------------------------------------------------------------------------------------------------------
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
PFObject *group = groups[indexPath.row];
//if(group[PF_GROUP_LOGO] != nil){
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ // go to a background thread to load the image and not interfere with the UI
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:group[PF_GROUP_LOGO]]]];
dispatch_async(dispatch_get_main_queue(), ^{ // synchronize back to the main thread to update the UI with your loaded image
cell.imageView.image = image;
cell.imageView.image = ResizeImage(image, 60, 60, 1);
cell.imageView.layer.cornerRadius = cell.imageView.frame.size.height /2;
cell.imageView.layer.masksToBounds = YES;
cell.imageView.layer.borderWidth = 0;
cell.textLabel.text = group[PF_GROUP_NAME];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d users", (int) [group[PF_GROUP_MEMBERS] count]];
cell.detailTextLabel.textColor = [UIColor lightGrayColor];
});
});
return cell;
}
最初の読み込み時に 'cornerRadius'値が設定されていることを確認しましたか?私は、イメージのビューは、角の半径が0になるようにサイズが変更されていないと思います。 – AdamPro13
私のファイルで私はそれを設定するだろうか?私のonLoadの権利ではない? –
この行の後にブレークポイントを設定します: 'cell.imageView.layer.cornerRadius = cell.imageView.frame.size.height/2;' – AdamPro13