Warning:attempt to present A on B whose view isn't in the window hierarchy!

Source: Internet
Author: User

Uiviewcontroller The main page of the display adds a ScrollView
Uicollectionviewcontroller comes with CollectionView
Uitableviewcontroller a comes with TableView
Uitableviewcontroller B is present by the interface
Add Collectionview,tableview to ScrollView to show slide effects

Problem, when present (modal) to Uitableviewcontroller is selected from Uicollectionviewcontroller cell, an error appears as follows:
Warning:attempt to present A on B whose view isn't in the window hierarchy!


Look at the information and say it's a messy view.
Need to change as follows
When adding a view to the ScrollView of Uiviewcontroller, add two sub-class controllers to the controller, respectively, for these two view
Controller that adds a subclass to view
[Self addchildviewcontroller:_attention]; [Self addchildviewcontroller:_allcontroll];


After the operation, there is effect, but the output shows as follows,
Presenting view controllers on detached view controllers is discouraged <attentioncontroller:0x7ff9d40376c0>.


When you should return to the selected cell, add the parent controll
[Self.parentviewcontroller PRESENTVIEWCONTROLLER:LISTVC Animated:yes Completion:nil];






Warning:attempt to present A on B whose view isn't in the window hierarchy!

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.