Usually I’m using NSLog to debug all sort of objects. When I encounter UINavigationBar background color issue, I loop through it’s subviews one by one. e.g.
1 2 3
for (id subview in navBar.subviews) { NSLog(@"subview %@", subview); }
Then I realize I need to go 1 level deeper, I add one more loop inside
1 2 3 4 5 6
for (id subview in navBar.subviews) { NSLog(@"subview %@", subview); for (id subsubview in subview.subviews) { NSLog(@"subsubview %@", subsubview); } }
which is not an effective way
Finally I found this recursiveDescription magic function to show all subviews recursively
It can’t be invoked by [view recursiveDescription], must be using performSelector. e.g.
1
NSLog(@"\nNav bar %@",[navBar performSelector:@selector(recursiveDescription)]);
P/S: Please remove this method before you submit the app to AppStore. This is private API, so there is high chances that your app will be rejected if you don’t remove this method.