Resolve warning presenting view controllers on detached view controllers is discouraged and extended

Source: Internet
Author: User

This warning is sometimes seen when modal jumps

presenting view controllers on detached view controllers is discouraged <picturenewtableviewcontroller: 0x7ff2ba495cc0>.

The reason is that the modal window present out, no longer use the present to eject other child windows

just change the self direct mode jump page to jump from the root controller

For example:

Picdetailviewcontroller *DETAILVC = [[Picdetailviewcontroller alloc] init];

[Self PRESENTVIEWCONTROLLER:DETAILVC animated:yes completion:nil]; Change into

Appdelegate *delegate = (appdelegate *) [uiapplication sharedapplication].delegate;

[Delegate.window.rootViewController PRESENTVIEWCONTROLLER:DETAILVC Animated:yes Completion:nil];

can be

to find the root controller:

method One: It is through the above method, first find appdelegate and then get window properties

Leftslideviewcontroller *ROOTVC = (leftslideviewcontroller*) [(Appdelegate *) [uiapplication sharedApplication]. Delegate Window].rootviewcontroller;

In addition to finding the root controller, this method can find any attributes defined in the Appdelegate class, such as:

Method Two: Directly through Keywindow to find the root controller, more direct

Leftslideviewcontroller *ROOTVC = (leftslideviewcontroller*) [UIApplication sharedapplication]. Keywindow.rootviewcontroller;

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.