I want to display a modal view when the user shakes the phone. I was trying self.tabbarcont开发者_运维百科roller presentModal... but this won't work in cases where there is already a modal view open (Case: User is clicking around, and he clicks something that opens a modal view controller. Now, the user shakes his/her phone - should display a modal view on top of everything else now.).
Basically, what I want to do is display a view on top of all the other open views. How do I do this?
Thanks!
You can add the view to the main application window. That will overlay the whole view hierarchy below it.
UIView *viewOnTop = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
applicationDelegate *appDel = [[UIApplication sharedApplication] delegate];
[appDel.window addSubview:viewOnTop];
精彩评论