gpt4 book ai didi

objective-c - 当事件指示器 View 可见时不允许用户交互

转载 作者:IT王子 更新时间:2023-10-29 08:01:47 25 4
gpt4 key购买 nike

我有一个包含两个 View 的 View 。其中一个 View 包含两个按钮和一些文本标签。另一个将 alpha 设置为 0.25,有一个 UIActivityIndi​​catorView 告诉用户该应用程序正在运行,他必须等到它完成。如果用户在 UIActivityIndi​​catorView 旋转时触摸按钮,当 UIActivityIndi​​catorView 停止时,应用程序会记住用户操作并对其做出响应。如何丢弃 UIActivityIndi​​catorView 旋转时发生的用户交互?

感谢阅读。

P.D.:喜欢在 this thread 中评论,我宁愿不要使用任何模态解决方案。

已编辑:

我目前正在使用此代码,但它无法正常工作。

- (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];
}

最佳答案

我发现这些方法非常有用:

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

[[UIApplication sharedApplication] endIgnoringInteractionEvents];

关于objective-c - 当事件指示器 View 可见时不允许用户交互,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5551432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com