IOS Programming UIWindow Switch

Source: Internet
Author: User
<span id="Label3"></p><p><p>As a result of the recent project needs to create a customizable bottom pop-up effect, so the study of uiactionsheet, intends to rewrite a custom pop-up window, when writing the demo for Lazy reasons, directly in the new project</p></p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">-(<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">void</span>) Viewdidload {}</p></p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">The window switch test code is written, and the result is the following error message when Debugging:</p></p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><strong>Terminating app due to uncaught exception ' nsinternalinconsistencyexception ', reason: ' application windows is expected to has a root view controller at the end of application launch '</strong></p></p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">?</p></p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: #3d1d81;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: #3d1d81;">Searched the internet for a while most of my friends said it was due to the version of Xcode and needed to be</p></p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">-(<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2;">BOOL</span>) application: (<span style="font-variant-ligatures: no-common-ligatures; color: #703daa;">uiapplication</span> *) application didfinishlaunchingwithoptions: ( <span style="font-variant-ligatures: no-common-ligatures; color: #703daa;"> Nsdictionary</span> *) launchoptions {}</p></p><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">?</p></p><p><p>method, Add a Rootviewcontroller manually. Follow the above method after the issue is still reported the same bug, then the window switch code written to the button click event, by clicking the event trigger Switch. This problem is solved by this method.</p></p><p><p>Preliminary cause Analysis:</p></p><p><p>May be in the <span style="font-family: Menlo; font-size: 11px; line-height: 13px;">viewdidload when the interface is not drawn, and at this time to switch the window so that caused the error of the exception, this is only one-sided speculation, I hope to have known friends to Correct. </span></p></p><p><p>IOS Programming UIWindow Switch</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.