0

活动指示器在我的代码中没有动画。我有以下代码

我该如何解决?是因为平均线程不更新指标状态吗?如果是这样,我该如何解决?

@interface ConnectionEstablishedViewController : UIViewController{
 IBOutlet UIActivityIndicatorView * activityView;
    IBOutlet UILabel *loadingLabel;
}
@property(nonatomic,retain)  UIActivityIndicatorView * activityView;

我在 my.xib 文件中分配了标签和活动指示器

.m

- (void) threadStartAnimating {
    [activityView startAnimating];
    loadingLabel.hidden=YES;
}
- (void) threadStopAnimating {
    [activityView startAnimating];
    loadingLabel.hidden=NO;
}


-(void)viewDidAppear:(BOOL)animated{


    [self threadStartAnimating];
    [NSThread sleepForTimeInterval:3.0];
    [self hunttable];//call hunttable in order to fetch hunt table data

    [NSThread sleepForTimeInterval:3.0];//sleep to prevent thread from overlap

    [self huntingarea];
    [NSThread sleepForTimeInterval:3.0];

    [self stands]; 
    [NSThread sleepForTimeInterval:3.0];

    [self weapons];
    [NSThread sleepForTimeInterval:3.0];

    [self backpack];
    [NSThread sleepForTimeInterval:3.0];

    [self descriptionget];
    [NSThread sleepForTimeInterval:3.0];

    [self threadStopAnimating];


}
4

1 回答 1

3

我有类似的问题

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self threadStartAnimating];
}
-(void)viewDidAppear:(BOOL)animated{
    .
    ...//functions
    [self threadStopAnimating];


}

以上应该工作

于 2012-05-26T21:45:08.690 回答