单击按钮更改视图/是否需要在 iPhone 中使用同步方法?
我已经创建了滚动视图并在滚动视图中设置了按钮。按钮水平滚动。我创建了表视图作为视图控制器的子视图。单击按钮后,数据将使用 XML 解析从 RSS 源显示在表视图中。因此,更改表视图中的数据取决于单击的按钮。当我更改为选择下一个按钮时,将开始解析并显示数据。所以需要一些时间。同时我想显示一些视图或禁用视图(这意味着,在解析时视图被禁用或用户无法执行任何操作,例如使用活动指示器冻结)。更改每个按钮时,将会发生相应的操作。我参考了一些教程,但我不明白?有人告诉我使用同步方法来解决问题。但我对此没有任何想法。请指导我并帮助我。给我一些示例应用程序和链接。
请参阅我的下图,
提前致谢!
问候,
普加尔
I have created scroll view and set the buttons in the scroll view. The buttons are scrolling horizontally. I created table view as subview for view controller. On clicking the buttons, the datas are displaying in the table view from RSS feeds using XML Parsing. SO changing the datas in the table view which depends the button clicking. When i changed to select the next button, the parsing will be started and displayed the datas. so it takes some times. In the mean time i want to display some view or disable the view(that means,on that parsing time the view is disable or user cant do anything like freeze with activity indicator). On changing the each buttons, the action will be happened. I referred some tutorials, but i cant get any idea? Some people told me to use synchronous method to solved the problem. But i don't have any idea about it. Please guide me and help me out.Give me some sample apps and Links.
see my below image,
Thanks in Advance!
Regards,
Pugal
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用同步网络调用来禁用用户输入。提出这个建议的人给了你非常糟糕的建议。
如果您只想禁用当前视图及其子视图的输入,您可以在视图控制器中执行
self.view.userInteractionEnabled = NO;
。如果您想禁用整个窗口的输入,可以执行
self.view.window.userInteractionEnabled = NO;
如果您覆盖全屏视图,则根本不需要禁用用户交互在您的用户界面之上。根据您的模型图像,我认为这就是您想要做的。为此,您可以执行以下操作:
Don't use synchronous network calls to disable user input. Whoever suggested that gave you very bad advice.
If you just want to disable input for your current view and its subviews, you can do
self.view.userInteractionEnabled = NO;
in your view controller.If you want to disable input for the entire window, you can do
self.view.window.userInteractionEnabled = NO;
You won't need to disable user interaction at all if you overlay a full-screen view on top of your user interface. Based on your mock-up image, I think this is what you're trying to do. To do this, you can do something like this: