在进程中禁用按钮

时间:2012-02-03 18:22:06

标签: xcode button process

如何禁用进程中的所有按钮。在我的项目按钮下载文件,当下载开始我将禁用所有按钮它完成应该是所有按钮工作。

- (IBAction)grabURLInBackground:(id)sender{

    NSURL *url = [NSURL URLWithString:@"http://db.tt/x8imQ0C"];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDelegate:self];
    [request setDownloadDestinationPath:@"/var/root/The best of S.A.F.rar"];
    [request setDownloadProgressDelegate:progressView];
    [request startAsynchronous];

}

1 个答案:

答案 0 :(得分:1)

一种简单的方法是为所有按钮创建IBOutletCollection,然后您可以像这样禁用它们:

[myButtons makeObjectsPerformSelector:@selector(setUserInteractionEnabled:) withObject:nil];

再次启用:

[myButtons makeObjectsPerformSelector:@selector(setUserInteractionEnabled:)];