Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.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
iOS:活动指示器和网络视图_Ios_Uiwebview_Uiactivityindicatorview - Fatal编程技术网

iOS:活动指示器和网络视图

iOS:活动指示器和网络视图,ios,uiwebview,uiactivityindicatorview,Ios,Uiwebview,Uiactivityindicatorview,我有一个场景,当文档需要时间在webview中下载时,用户可以按下活动指示器中提供的取消按钮并停止下载。我正在使用另一个库作为活动指示器。我需要知道在webview中,活动指示器中的按钮已被单击,或者我如何能够访问活动指示器库中的webview。我可以在其他文件中设置活动指示器取消按钮选择器方法吗?非常感谢您的快速帮助。您可以使用NSNotificationCenter获取按下取消按钮的事件: 添加观察者 [[NSNotificationCenter defaultCenter]addObser

我有一个场景,当文档需要时间在webview中下载时,用户可以按下活动指示器中提供的取消按钮并停止下载。我正在使用另一个库作为活动指示器。我需要知道在webview中,活动指示器中的按钮已被单击,或者我如何能够访问活动指示器库中的webview。我可以在其他文件中设置活动指示器取消按钮选择器方法吗?非常感谢您的快速帮助。

您可以使用NSNotificationCenter获取按下取消按钮的事件:

添加观察者

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(cancelButtonClicked:) name:@"cancelButton" object:nil];
实施取消方法

-(void)cancelButtonClicked:(NSNotification *)notification{
   // Do your action here
}
此外,使用“取消”后,不要忘记删除观察者:

[[NSNotificationCenter defaultCenter] removeObserver:self];
有关详细信息,请查看此项:


您可以使用
委派
通知
告诉包含UIWebView的类,取消按钮已在另一个类(您的活动指示器类)中按下。

非常感谢。这真的很有帮助