开发者

Xcode Adding Subview on entire screen above everything

开发者 https://www.devze.com 2023-03-22 13:52 出处:网络
I want to use addSubview method to add new view on my screen. However, new view must also include navigation bar etc. which means it should include entire screen. What should i do?

I want to use addSubview method to add new view on my screen. However, new view must also include navigation bar etc. which means it should include entire screen. What should i do?

Whenever i try to addSubview it alway开发者_JAVA技巧s shows new view under navigation bar.

I don't want to use pushViewController or presentModelViewController because new added view will be low opacity and i can see background but i do not want to interact with background objects like bar buttons table etc. Sorry for english, i hope, i clearly told what problem is.


Just set the frame property of the view you add before, and set it with screen bounds.

[myView setFrame:[[UIScreen mainScreen] bounds];
[self.navigationController.view addSubview:myView];

If you want to disable interaction with the navigation bar :

[self.navigationController.navigationBar setUserInteractionEnabled:NO];


You could take a look at adding another UIWindow above your root window.


when I tried doing the navigationController.view addSubview, it wouldn't cover my tab bar so I did the following with my app delegate's window:

[self.window addSubview:myView];

if you need access to your appDelegate from another class, you'd just import your application delegate and call it from that.

0

精彩评论

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