Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show customView(uitableview) get Warning on iOS13 #200

Closed
zhxf2012 opened this issue Nov 27, 2019 · 7 comments
Closed

show customView(uitableview) get Warning on iOS13 #200

zhxf2012 opened this issue Nov 27, 2019 · 7 comments

Comments

@zhxf2012
Copy link

show a custom view witch has a uitableview,using : show(customView: UIView, direction: PopTipDirection, in view: UIView, from frame: CGRect, duration: TimeInterval? = nil)

It dosnot crash but warning once and the log suggest fixed it. It get waring at consol as below:

[TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. Table view: <UITableView: 0x7fe52d8c3800; frame = (0 0; 90 170); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x600001ea4300>; layer = <CALayer: 0x600001044700>; contentOffset: {0, 0}; contentSize: {90, 220}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <xxxxxxxxx: 0x7fe52be231c0; frame = (0 0; 90 170); layer = <CALayer: 0x6000010479c0>>>

    And I use  a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this get breakpoint at PopTip.swift (AMPopTip (4.3.0))  at line 605 .

customView.layoutIfNeeded()

maybe this can be done as log below suggest: defer it until the table view has been added to a window.

@andreamazz
Copy link
Owner

That call is right after a addSubview(customView) though.
Can you share some sample code to reproduce the issue?

@zhxf2012
Copy link
Author

Demo.zip
I use your demo and add a file and a button. You can reproduce the issue

@andreamazz
Copy link
Owner

That call is right after a addSubview(customView) though.
Can you share some sample code to reproduce the issue?

Didn't notice that the contianer wasn't in the hierarchy yet, I'll move the call to layoutIfNeeded later down the entrance animation chain, I just need to make sure that it doesn't break other stuff first.

@zhxf2012
Copy link
Author

Thanks for such a good library,Thank you.

@andreamazz
Copy link
Owner

Ok, seems safe to remove. I'll push a new release

@andreamazz
Copy link
Owner

Version 4.4.0 is up

@zhxf2012
Copy link
Author

Thank you . I am using 4.4.0. It is excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants