我想在ActivityIndicator
上添加UIButton
所以我确实喜欢这个
-(IBAction)SetNationality:(id)sender
{
actInd=[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[btnpost addSubview:actInd];
[actInd startAnimating];
NSMutableDictionary *dictionaly=[[NSMutableDictionary alloc] init];
[dictionaly setValue:[NSNumber numberWithInt:0] forKey:@"NationalityCode"];
[dictionaly setValue:@"nationalitytest test" forKey:@"NationalityName"];
[dictionaly setValue:[NSNumber numberWithInt:0] forKey:@"Deleted"];
[dictionaly setValue:[NSNumber numberWithInt:1] forKey:@"Status"];
NSMutableDictionary *dictNationality=[[NSMutableDictionary alloc] init];
[dictNationality setObject:dictionaly forKey:@"Nationality"];
[wb prepareURL:@"ProfileConfig/Nationalities" :@"" :YES :NO :dictNationality:^(NSString *status)
{
[self DataReceived];
}];
}
然后我删除此方法中的活动指示器
-(void)DataReceived
{
[actInd removeFromSuperview];
NSLog(@"data array %@",dm.arrayData);
}
但我的问题是activityindicator没有从超级视图中删除。它不停旋转。我怎么解决这个问题。 感谢
答案 0 :(得分:2)
试试这段代码:
pro
答案 1 :(得分:2)
无需从父视图中删除活动指示符。 只需停止活动指示器动画即可。
-(void)DataReceived
{
dispatch_async(dispatch_get_main_queue(), ^{
[actInd stopAnimating];
});
}
答案 2 :(得分:0)
希望这可以帮助你:
- (void) hideActivityIndicator {
actInd.hidden = YES;
[UIView animateWithDuration:0.3 animations:^{
actInd.alpha = 0.0;
} completion:^(BOOL finished) {
[actInd stopAnimating];
}];
}