开发者

How do I display a view above all others?

开发者 https://www.devze.com 2023-04-05 18:27 出处:网络
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

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消