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.
The title in the navigation bar should be displayed in large mode on top of the table view.
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>>
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
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.
Have same issue with enabled Hero, please add fix from brendan
Same issue here! Please add fix!
I also faced this issue please fix it.
Sent a PR #680 applying cfaf2e4 by @aragevorkian
Most helpful comment
Have same issue with enabled Hero, please add fix from brendan