当我添加一个 UIActivityIndicatorView
作为我的一个 UITableViewCell
的 subview 时,我遇到了这样的情况,它只会旋转一小会儿然后停止。有谁知道为什么?
这就是我在代码中所做的原则:
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell" forIndexPath:indexPath];
if (indexPath.row == 0) cell.accessoryView = spinner;
UILabel *label = (UILabel *)[cell viewWithTag:1];
label.text = @"Some text";
return cell;
}
其中 spinner
是一个 IBOutlet
:
IBOutlet UIActivityIndicatorView *spinner;
最佳答案
尝试将其插入到函数中。
[spinner startAnimating];
如果你想让它停止,调用stopAnimating方法。
关于ios - UIActivityIndicatorView 停止旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30502836/