0
このコードでUITableViewCell
にUIActivityIndicatorView
を追加しました。UITableViewCellでUIActivityIndicatorViewを配置する方法
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
UIImage *spacer = [UIImage imageNamed:@"spacer"];
UIGraphicsBeginImageContext(CGSizeMake(220, 150));
[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];
現在、画像は220x150ボックスの左上に表示されています。代わりに私はそれを中心に置いておきたいと思います。どうやってやるの?私はCGRectMake
の2つの最初のパラメータを変更しようとしましたが、何も変更されませんでした。