我有一个加载了 tableView 的 FirstView,当点击 tableviewCell 的附件按钮时,它会转到 SecondView。SecondView 中的数据是从服务 url 加载的,因此需要时间。所以我需要在点击附件按钮时显示 activityIndicator,停止它加载整个数据后。但我看不到显示活动指示器。
这是我正在处理的代码:
- (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
 activityIndicator = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(143, 220, 37, 37)];
 activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
 activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
 activityIndicator.color = [UIColor redColor];
 [scrollView  addSubView:activityIndicator];
 [activityIndicator startAnimating];
 activityIndicator.frame=CGRectMake(140, 195, 37, 37);
 [activityIndicator startAnimating];
        SecondView *secView = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil];
        secView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
        UILabel *name1 = (UILabel*)[cell viewWithTag:111];
        secView.provName = [name1 text];
        [self presentModalViewController: secView animated:NO];
        [secView release];
    }
我要去哪里错了?
编辑:
第二视图:
-(void)viewWillAppear:(BOOL)animated
{
    activityIndictr = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(143, 220, 37, 37)];
    activityIndictr.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
    activityIndictr.color = [UIColor redColor];
    [testscroll addSubview:activityIndictr];
    [activityIndictr startAnimating];
}
-(void)viewDidLoad
{
  [super viewDidLoad]
   // I m calling many service urls(10) and assigning to labels and tableview 
  [activityIndictr stopAnimating];
}