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

UITableViewAlertForLayoutOutsideViewHierarchy Xcode warning on run #640

Closed
brendan-guegan-orange opened this issue Nov 8, 2019 · 4 comments · Fixed by #680
Closed

UITableViewAlertForLayoutOutsideViewHierarchy Xcode warning on run #640

brendan-guegan-orange opened this issue Nov 8, 2019 · 4 comments · Fixed by #680

Comments

@brendan-guegan-orange
Copy link

What did you do?

My application contains a UITabBarController with several items.
Each item is a UINavigationController with UITableViewController or UIViewController as root, and is set to prefer and display large titles.
In the ones containing UITableViewController, when the controller is displayed for the first time, the large title is not displayed but the small one displayed instead.

What did you expect to happen?

The title in the navigation bar should be displayed in large mode on top of the table view.

What happened instead?

The title in the navigation bar is displayed in small mode on top of the table view (the bar is 44 points height).
The Xcode console displays the following message :
[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: 0x7ff22a8a1000; frame = (0 0; 414 736); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600001eb2b50>; layer = <CALayer: 0x600001049340>; contentOffset: {0, 116}; contentSize: {414, 249}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <MyApp.UITableViewController: 0x7ff22a0e7600>>

General Information

  • Hero Version: 1.5.0

  • iOS Version(s): 13.1

  • Swift Version: 5.1

  • Devices/Simulators: iPhone 8 Plus Simulator, iPhone X Device

  • Reproducible in Examples? (Yes/No): Don't know

Workaround

I've identified the line that seems to cause the Xocde warning in the file HeroTransition+Start.swift, line 37 in the start() method : toView.layoutIfNeeded().
By adding a check if the toView has a window, the issue is fixed, the message does not appear in Xcode console and the tableview displays properly :

if nil != toView.window {
     toView.layoutIfNeeded()
}

What I'm not sure is the consequences of that little change.

@anDeRanV2
Copy link

Have same issue with enabled Hero, please add fix from brendan

@GZaccaroni
Copy link

Same issue here! Please add fix!

aragevorkian added a commit to aragevorkian/Hero that referenced this issue Mar 25, 2020
@najeeburrehman-brainx
Copy link

I also faced this issue please fix it.

@philipbel
Copy link

Sent a PR #680 applying cfaf2e4 by @aragevorkian

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

Successfully merging a pull request may close this issue.

5 participants