Reputation: 3472
I want to place a UIView
that will inform the user what is the status of the app. I want that view to be visible even if the user switches views, same thing as the UINavigationBar
is always visible, but I don't want to use that bar, I would like to add another view that will show a message.
How can this be done? I can't add the view
to the current view
, because it will disappear, if the user changes views.
It should be added to the window
? But how? I would then have to resize the views so that my new view
can fit, but how?
Thanks.
Upvotes: 2
Views: 203
Reputation: 2064
If you have a UINavigationController
you can add your view to its view.
[self.navigationController.view addSubView:yourView];
Presenting modal views would cover the view, as stated in the other answer.
Upvotes: 0
Reputation: 11174
Create a container view controller and set it as the rootViewController
of the apps window.
Inside this container you have your status view, and you also resize the windows real rootViewController
to take up the remaining space as a subview. If you are using a standard container view conrtoller (tab, navigation etc) as the root then you can use standard navigation methods and the status view will always be visible
There would be problems if you wanted to present modal views though, since these would go over the top of the status view
Upvotes: 1
Reputation: 3905
In your appDelegate.m
add your view as subView of window.
UIView *mainBg = [[UIView alloc] init];
mainBg.frame = newframe;
[self.window addSubview:mainBg];
Upvotes: 0