love_loveec 2013-03-06 02:51 采纳率: 85.7%
浏览 2196

加载符号没有在button点击出现

-(IBAction)addtocontacts:(id)sender
{
    HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    HUD.labelText = NSLocalizedString(@"Saving_data", @"");

    //added my validation here
   [self performSelectorInBackground:@selector(insertDetails) withObject:nil];
}
-(void) insertDetails
{
  //save contact details in database
[HUD hide:YES];
    UIAlertView *alertview=[[UIAlertView alloc]initWithTitle:@"" message:@"Contact account details added" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alertview show];
}

我在savebutton点击添加了加载符号,但是没成功,怎么让符号出现,到了有警告信息时再消失?

  • 写回答

3条回答

  • ArcRain 2013-03-06 06:08
    关注

    performSelectorInBackground这里马上就去运行了,同时[HUD hide:YES];又让loading动画隐藏了。
    你可以试着注释掉[HUD hide:YES];
    另外,有关UI的操作,最好都不要放到Background线程里,因此performSelectorInBackground最好改为performSelector

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog