如果重复了主题,我很抱歉,但我找不到解决方案。我正在尝试进行一些计算,并且在执行它们期间,我希望用户在滑动后立即看到活动指示器。用户应该看到指示器并等待带有结果的 textView 出现。当我使用我所写的内容时,指示器不会出现(我认为它会同时出现并消失)。如何在计算开始之前显示它并在我的计算结束时隐藏它?
-(IBAction)swipeRight:(UISwipeGestureRecognizer *) recognizer {
activityIndicator.hidden = NO;
[activityIndicator startAnimating];
//some calculations are being done here
textViewInfo.text = [NSString stringWithFormat:@"results of long calculations..."];
textViewInfo.alpha = 1;
activityIndicator.hidden = YES;
[activityIndicator stopAnimating];
}