Dan*_*ena 21 objective-c user-interaction uiactivityindicatorview ios
我有一个包含两个视图的视图.其中一个视图包含两个按钮和一些文本标签.另一个,alpha设置为0.25,有一个UIActivityIndicatorView告诉用户应用程序正在工作,他必须等到它完成.如果用户在UIActivityIndicatorView旋转时触摸按钮,则当UIActivityIndicatorView停止时,应用记住用户操作并响应它.如何丢弃UIActivityIndicatorView正在旋转时发生的用户交互?
谢谢阅读.
PD:就像在这个帖子中评论一样,我更喜欢不使用任何模态解决方案.
编辑:
我目前正在使用此代码,但它无法正常工作.
- (void)viewDidAppear:(BOOL)animated {
// The view appears with an UIActivityIndicatorView spinning.
[self showResults]; // The method that takes a long time to finish.
[self.activityIndicator stopAnimating];
// When the showResults method ends, the view shows the buttons to the user.
[self.activityIndicatorView setHidden:YES];
[self.menuButton setEnabled:YES];
[self.menuButton setUserInteractionEnabled:YES];
[self.playButton setEnabled:YES];
[self.playButton setUserInteractionEnabled:YES];
[self.view setUserInteractionEnabled:YES];
[self.interactionView setUserInteractionEnabled:YES];
}
Run Code Online (Sandbox Code Playgroud)
ppa*_*ica 109
我发现这些方法非常有用:
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
Run Code Online (Sandbox Code Playgroud)
小智 5
在Swift 3.0中要禁用交互:-
UIApplication.shared.beginIgnoringInteractionEvents()
Run Code Online (Sandbox Code Playgroud)
恢复交互:-
UIApplication.shared.endIgnoringInteractionEvents()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30583 次 |
| 最近记录: |