When sending a Weibo message, you need to use mbprogresshud to overwrite the window and wait for the message to be sent successfully. However, the keyboard cannot overwrite the window.
So all kinds of research, add to view, add to window, all have no results .. I think that I can't cover all windows. This is really amazing.
Then I suddenly checked the count of the window and found that there were two windows !!! I think the iPhone should have only one window .. But I vaguely remember who said that the iPhone sometimes has multiple windows.
Finally, the HUD is added to the second window, And the overwrite is successful.
After traversing the views of the second window, we found that there was a keyboard in it, and it was very clear.
Originally, the second window was used to hold the keyboard. You can add the HUD to the window where the keyboard is located to overwrite the keyboard.
PseudoCodeAs follows:
Uiwindow* Win = [[UiapplicationSharedapplication].WindowsObjectatindex:1];
Mbprogresshud* Hub = [[MbprogresshudAlloc]Initwithwindow: Win];
Hub.Mode=Mbprogresshudmodeindeterminate;
Hub.Labeltext=@"Sending...";
[WinAddsubview: Hub];
[HubShow:Yes];
[HubHide:Yes Afterdelay:3];
[HubRelease];
The result of traversing views is as follows:
18:05:53. 453 huddemo [3736: f803] view0 is <bandwidth: 0x689f550; frame = (0 228; 320 252); autoresizessubviews = no; layer = <uiperipheralhostlayer: 0x68a93b0>
18:05:53. 455 huddemo [3736: f803] view1 is <uikeyboardcornerview: 0x68aa1f0; frame = (0 473; 7 7); opaque = no; userinteractionenabled = no; layer = <calayer: 0x68aa230>
18:05:53. 455 huddemo [3736: f803] view2 is <uikeyboardcornerview: 0x68aa3a0; frame = (313 473; 7 7); opaque = no; userinteractionenabled = no; layer = <calayer: 0x68aa3e0>
18:05:53. 455 huddemo [3736: f803] view3 is <mbprogresshud: 0x6ab27a0; frame = (0 0; 320 480); alpha = 0; opaque = no; autoresize = Lm + RM + TM + bm; layer = <calayer: 0x6abd860>
I also hope that the experts will give me some advice on how iOS will have multiple windows...