Reputation: 5168
I have an app with a UITabBarController
, a few UINavigationController
nested in it, and subclasses of UITableViewController
inside those navigation controllers. When I try to push a newly created UITableViewController
onto an existing navigation controller with an existing tableView in it, the app hangs, and Instruments shows that it keeps allocating something, over and over again, with a call to [UIWindow _subtreeMonitorsForView:]
, whatever that is.
I'm pushing the controller in a very simple way, just:
_orderForm = [[OrderFormViewController alloc] init];
[self.navigationController pushViewController:_orderForm animated:YES];
If I change it so that I push a plain UIViewController
instead of a table, it works just fine. That is, if I just change the declaration in the OrderFormViewController.h file from UITableViewController
to UIViewController
and it shows me the blank view, no hanging. What could be the problem?
Note, the content of OrderFormViewController.h is very bare bones, contains just the standard built in functions. I tried pushing a different subclass of UITableViewController
(which works fine when used to initialize a UINavigationController
) and the result is the same - app hangs and keeps eating memory.
Upvotes: 1
Views: 225
Reputation: 5168
I have found the culprit to this and a couple of other similarly acting bugs. It was the fact that I doing this in my app delegate before instantiating my controllers:
UIView *bg = [[UIView alloc] initWithFrame:CGRectZero];
bg.backgroundColor = [UIColor whiteColor];
[[UITableView appearance] setBackgroundView:bg];
Something about using [UITableView appearance]
just does not play well with the code down the line, including being unable to use UIDatePicker
in any variation (though UIPickerView
still worked, which only confused me further).
For some reason the whole UIAppearance
protocol, as promising as it sounds, is having some issues, this is not the first time I found it to be the cause of some odd bugs. Getting rid of it makes everything work perfectly.
Upvotes: 1