if we try to add view to self.window
[window addSubView:someviewcontroler.view];
why the view is hiden behind the status bar upto 20 pixel?
I found the solution to hide the status bar or set view.frame.origin.y to 20.
but I want to know why it hides.
Any reason?
That's no longer the way you'll want to show your root UIViewController. (it used to be, but it got changed a while back... possibly iOS 5? in iOS 4)
To prevent the issue try using
window.rootViewController = someviewcontroller
Related
When I minimize and maximize app in iOS 6 whole application view moves up by 20 pixel. (looks like ignoring status bar) But on iOS 7 its ok because status bar is overlaid on the application view.
I don't want app view to be moved up.
Can anyone explain what's happening?
I know that this is bad solution but I had no other way to do this :(
I just moved down main window by 20 pixel in applicationWillEnterForeground.
- (void)applicationWillEnterForeground:(UIApplication *)application
{
if(!iOS7)
[self.window setY:20];
}
This works good now : )
Hope this helps anyone : )
This worked for me:
I checked "Adjust Scroll View Insets" in the MainStoryboard Attributes Inspector and it worked.
NOTE: I'm using a UITAbleView embedded in a Navigation Controller embedded in a tabViewController. I "selected" the main TabBarViewController.
The screen doesn't hide behind the header anymore.
This link helped a lot: UITableView embedded in other view has wrong position of section header
How can I get the navigationbar in my iPhone application to match the one in other apps such as Safari as the time and bar are merged. Here's what mine looks like compared to MobileSafari.
Safari
My App
Thanks for your help! (:
This is a common problem and I had the same, but solved very easily by just setting the UINavigationBar Y-position to 20px and not to 0px. Then you have to assign the UINavigationBarDelegate to your ViewController:
[_navigationBar setDelegate:self];
Furthermore you have to add this method to your ViewController, which will be called because of the Delegate assignment:
-(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar
{
return UIBarPositionTopAttached;
}
It looks like you did It already. Safari just has a UITextField instead of a title label in the center. Navigation bars are now 64px in height for iOS 7 and automatically go under the navigation bar
I have an iOS app where the main screen is a UICollectionViewController. When selecting an Item from the collection view the view is pushed to a detail view of the item. In the detail view I built a drawer/slider that moves out from the side. In order to get the view to look the way I wanted I hid the default navigation bar and inserted one via storyboards.
I ran into an issue that when hiding the default navigation bar you lose the back button functionality that comes with using a navigation controller. I worked around this by adding a button where the back button would have been (the image above is shown without the button). Now I use the line of code below to move back to the collection view.
[self.navigationController popToRootViewControllerAnimated:YES];
It works the way I want it except that I lose my Navigation Bar when I return to the collection view. Does anyone have any thoughts on how to fix this? Thanks in advance!
In viewWillAppear of your rootViewControler
-(void)viewWillAppear:(BOOL)animated{
[self.navigationController setNavigationBarHidden:NO];
}
I know this thread it's a little dated (more than dated more like an archive). But I ran into the same issue in swift 5, Xcode 13. Below is the swift code that I used in my viewWillAppear in case it helps someone.
self.navigationController?.setNavigationBarHidden(false , animated: true)
Experts, Please share the best approaches and practices that must be taken care while adding a UIWindow on top of current window.(Window1) I have a situation where I have locked the orientation of a view "A" to Portrait in a view controller. Then I create a new UIWindow and make it as key and visible. The root view controller of this new UIWindow is again a view controller which supports all orientations. The issue I am having is whenever I make the previous window (say window1)as key and visible again, and try to rotate the device,eventhough the view stays locked to specific orientation(say Portrait), the status bar is rotating which looks very wierd.
I think it is a bad idea to rotate a custom alert to an orientation that is not supported by an application. Anyway. To prevent a status bar rotation you should remove your second window
[alertWindow setHidden:YES];
[alertWindow release];
alertWindow=nil;
after disappearence of your alert.
You also might consider usefull this liks:
https://github.com/eaigner/CODialog
https://github.com/gpambrozio/BlockAlertsAnd-ActionSheets
https://github.com/kyoshikawa/ZPopoverController
https://github.com/TomSwift/TSAlertView
I'm developing an iPhone app that switches from a table view to a landscape fullscreen view (similar to the YouTube app). When it does so, I want to hide the status bar, then display it again when switching back to the table view. I'm using setStatusBarHidden but that just seems to hide the status bar wihout enlarging the screen area; there's still a blank bar where the status bar was. If set the hidden status bar property in Info.plist then I get the enlarged screen area but when the status bar displays it overlays the view.
How do I hide the status bar in such a way that the full screen is available to my view when it's hidden and only the screen under the status bar when it's displayed?
TIA.
Craig
PS: I copy/edit this question from app discussion. do not find good solution
http://discussions.apple.com/thread.jspa?threadID=1580662&start=15&tstart=0
Your view controller should have wantsFullScreenLayout set to YES, as well as hiding the status bar: See UIViewController reference.
If there is anyone looking for a solution where the above solution does not work (and there is still an annoying blue 20px gap at the top), try putting this in the viewWillAppear on the implementation file of the view controller that you would like the status bar to be hidden.
self.navigationController.navigationBar.frame = CGRectOffset(self.navigationController.navigationBar.frame, 0.0, -20.0);
That literally took me 12 hours or so to fix, and that was the solution, so now i'm spreading the word in case anyone else has this annoying issue.