I have a problem. I am using three20 and am using TTYoutubeView, this problem does not necessarily require knowledge of three20 to fix I think.
My issue is, i have a custom drawMethod on my navigationBar, however, when i load a youtube video, i need to tell it to ignore my custom draw method (this isn't a problem, i have a global BOOL that can do this).
My problem is, there is no way i can detect when the youtube video loads, it is launched via an object within a UIWebview, so no UITouches to catch, and I don't fancy subclassing the UIWebview, as after the youtube video has been dismissed, i have no way to catch this either.
What i require, is a method that whenever my navigationbar is drawn asks 'What class is the current viewController', then i can tell it what to draw dependent on what is being displayed.
NSLog(@"%@",[TTNavigator navigator].topViewController);
NSLog(@"%@",[TTNavigator navigator].visibleViewController);
I am logging out the viewControllers in my draw method, this works perfectly, my code logs as follows
2010-09-08 16:39:23.171 MyApp[3512:307] <HomeController: 0x264df0>
2010-09-08 16:39:23.174 MyApp[3512:307] <HomeController: 0x264df0>
The problem is, when the youtube video loads, it seems to load a modalViewController, my code still logs out the viewController that is underneath this modalController. It does not tell me what is on top.
Detecting the viewController seemed like a bright spark when i thought of it, and it still is a good idea as far as i'm concerned. I'm just at a loss as to how I can find out what view is currently on top. (as topViewController and visibleViewController don't seem too do this accurately)