我正在尝试从网站获取数据 - xml.一切正常.
但是UIButton仍然被按下,直到返回xml数据,因此如果互联网服务出现问题,它就无法纠正,而且应用程序几乎无法使用.
这是电话:
{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
if(!appDelegate.XMLdataArray.count > 0){
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[appDelegate GetApps]; //function that retrieves data from Website and puts into the array - XMLdataArray.
}
XMLViewController *controller = [[XMLViewController alloc] initWithNibName:@"MedGearsApps" bundle:nil];
[self.navigationController pushViewController:controller animated:YES];
[controller release];
}
Run Code Online (Sandbox Code Playgroud)
它工作正常,但如何使视图按钮功能卡住.换句话说,我只是希望UIButton和其他UIButton能够在后台运行时起作用.
我听说performSelectorInMainThread但我不能正确地练习它
任何帮助表示赞赏:)