search

Home  >  Q&A  >  body text

objective-c - button点击触发的pushViewController怎么避免多次弹出控制器?

点击button,push到另一个controller,但是有时网络不好,点击了却没有响应,再点击一次,会弹出两次控制器,这种情况应该怎么优雅的处理。

仅有的幸福仅有的幸福2757 days ago650

reply all(4)I'll reply

  • 世界只因有你

    世界只因有你2017-05-02 09:22:41

    The problem description does not explain the background.
    If the network request is stuck and the main thread is blocked.
    Asynchronously put the network request into the concurrent queue, click the button, and execute the push method.
    Or disable the button after clicking it, and restore the button after the network blocking is completed.

    reply
    0
  • ringa_lee

    ringa_lee2017-05-02 09:22:41

    I think you can add a flag and make an if judgment. If the user clicks the flag and sets it to true, the next time it is judged to be true, he will not be able to click, or the click will have no effect.

    reply
    0
  • 为情所困

    为情所困2017-05-02 09:22:41

    Generally, a HUD is loaded to block the interface and prevent user operations.

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-02 09:22:41

    The best user experience should be to give the user an interaction when touching the button, that is, set a flag to prevent the user from submitting. In addition, try to let the user see the status of the submission, and try again after the final success or failure. Interact with the user to complete the submission operation

    reply
    0
  • Cancelreply