Showing Waiting Alert View At Load

前端 未结 4 1620
不知归路
不知归路 2021-01-24 12:47

I would like when my app starts for it to show an Alert view for about 5 seconds, then depending on the outcome of a background process, it will show another Alert view.

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-24 13:07

    Don't use sleep on the main thread. Ever. Also don't update UI from a background thread.

    What you want to do is to display your alert on the main thread and return.

    Then, when your networking code completes, have it send a message to the main thread. In the main thread, when you receive a notice that it's done, remove the alert.

提交回复
热议问题