[IOS] Calls Presentviewcontroller and Dissmissviewcontroller for frame display errors

Source: Internet
Author: User

Today in the Detection album (Photo+camera) This part of the bug, found in the long press Photo, video or click the photo icon, and then return to the original view (Assettableviewcontroller), the view will display an error, A blank is displayed.

Here is a summary of my work ideas and debugging steps:

1. Set breakpoints to see the frame size of the view controller by setting breakpoints in both Viewwillappear and viewwilllayoutsubviews of the Returned view controllers

2. Reproduce the bug: Long according to the film or video, etc., when entering the view at the two endpoints to see the view of the frame changes!!

Specifically: It will enter the Viewwilllayoutsubviews function 3 times, and be changed in the second and third times, Y becomes 0.

3. Follow the code and be bold: discover that the returned operations have called Presentviewcontrollerhe Dismissviewcontroller at the same time (this is difficult and critical)

Trying to find a solution on the Internet, not the results! After each function by adding their own previously written by a webbrowserviewcontroller to detect, will presentviewcontroller this code to Webbrowserviewcontroller, and then return, I was surprised to find that there was no problem.

4. Try to solve: Presentviewcontroller is the Uiviewcontroller method, its implementation we can not change, so only from their own code. First the view is nested inside another view, so try

A containervc = [uiapplication sharedapplication].keywindow.rootviewcontroller for present and dismiss. Found out right after the experiment!

Although the problem solved, but still do not know why, I hope that crossing can participate in the discussion and make suggestions ~ ~

[IOS] Calls Presentviewcontroller and Dissmissviewcontroller for frame display errors

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.