我有一個FirstView加載了tableView,當點擊tableviewCell的附件按鈕時,它會去SecondView.TheView中的數據從服務url加載,所以它需要時間。所以我需要顯示activityIndicator時accessorybutton被輕敲,加載整個數據後停止它.Bt我無法看到activityindicator顯示。UIActivityIndicator not displayed
這是工作的代碼林:
- (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];
}
我在哪裏要去錯了嗎?
編輯:
SecondView:
-(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];
}
很抱歉,但我不明白這u.By stmnt「拋出的第一個客場」如果不使用第一個指標則Y來創建它。? – Sindhia