2013-10-12 3 views

Répondre

3

essayer comme ça

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"NoReuse"] autorelease]; 
cell.textLabel.text = @"Loading..."; 

UIActivityIndicatorView *spinner = [[[UIActivityIndicatorView alloc] 
    initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease]; 

// Spacer is a 1x1 transparent png 
UIImage *spacer = [UIImage imageNamed:@"spacer"]; 

UIGraphicsBeginImageContext(spinner.frame.size); 

[spacer drawInRect:CGRectMake(0,0,spinner.frame.size.width,spinner.frame.size.height)]; 
UIImage* resizedSpacer = UIGraphicsGetImageFromCurrentImageContext(); 

UIGraphicsEndImageContext(); 
cell.imageView.image = resizedSpacer; 
[cell.imageView addSubview:spinner]; 
[spinner startAnimating]; 

return cell; 
+1

@ sonbt91 est-il fonctionne – Sport

+0

Merci, ça n'a pas fonctionné! – sonbt91

1
UIActivityIndicatorView *spinner = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease]; 
spinner.frame = CGRectMake(205.0f, 0.0f, 44.0f, 44.0f); 
spinner.tag = 3; 
[cell.contentView addSubview:spinner]; 
+1

Si vous fournissez du code, s'il vous plaît élaborer pour le rendre clair à l'OP. – Abbas

Questions connexes