Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iphone:UIAlertView未消失并阻止UIProgressView_Iphone_Uialertview_Uiprogressview - Fatal编程技术网

iphone:UIAlertView未消失并阻止UIProgressView

iphone:UIAlertView未消失并阻止UIProgressView,iphone,uialertview,uiprogressview,Iphone,Uialertview,Uiprogressview,我有一个UIAlertView,询问用户是否要复制一组联系人。用户单击“继续”后,我希望AlertView消失,并被显示加载速率的UIProgressView替换 除了在用户单击“继续”后警报仍保留在XIB上,并且在整个流程运行之前警报不会消失之外,其他所有功能都正常运行。一旦它消失,UIProgressView栏就会出现,但此时它已达到100% 如何立即清除屏幕上的UIAlertView并显示进度条 这是密码。谢谢你的帮助 -(IBAction)importAllAddressBook:(id

我有一个UIAlertView,询问用户是否要复制一组联系人。用户单击“继续”后,我希望AlertView消失,并被显示加载速率的UIProgressView替换

除了在用户单击“继续”后警报仍保留在XIB上,并且在整个流程运行之前警报不会消失之外,其他所有功能都正常运行。一旦它消失,UIProgressView栏就会出现,但此时它已达到100%

如何立即清除屏幕上的UIAlertView并显示进度条

这是密码。谢谢你的帮助

-(IBAction)importAllAddressBook:(id)sender {

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Import ALL Contacts" message:@"Do you want to import all your Address Book contacts?  (Please note that only those with a first and last name will be transfered)" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Continue", nil];
    [alert show];
    [alert release];


}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

    if (buttonIndex == 0) {
        NSLog(@"NO STOP");
        return;
    }else {
        NSLog(@"YES CONTINUE");
        importAllContactsProgress.hidden = NO;  // show progress bar at 0
        [self importAllMethod];           
        }
}

// method to import all Address Book
-(void) importAllMethod {


    importAllContactsProgress.progress = 0.0;

   load names etc etc 

您需要在后台线程上执行导入:

[self performSelectorInBackground:@selector(importAllMethod)];

您的导入方法正在阻止主线程并阻止任何UI操作的发生。

aha。谢谢这是有道理的。