What is the android.widget.Toast equivalent for iOS applications?

前端 未结 6 2195
灰色年华
灰色年华 2020-12-13 05:44

I have made Android application a few months ago. The Toast class is very useful for me. I do not need to consider the main Thread and place to show it. Anywhere I can show

6条回答
  •  生来不讨喜
    2020-12-13 06:35

    There is no class "out-of-the-box" in UIKit to do this. But it is quite easy to create a class that will offer this behavior.

    You just have to create a class that inherit from UIView. This class will have the responsibility - to create what you want to display, - to add itself in parent view hierarchy - to dismiss itself using a timer.

    You will be able to use it like :

    [ToastView toastViewInView:myParentView withText:@"what a wonderful text"];
    

    Regards, Quentin

提交回复
热议问题