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
上的两个第一个参数,但这并没有改变任何东西。