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
上的兩個第一個參數,但這並沒有改變任何東西。