I've seen a few posts on here regarding this issue, and I've tried all the fixes, but I still can't seem to get this to work.
I have an iOS7 app which uses a Storyboard. The First view is a TableViewController. When I run the app, the status bar with the battery level and signal level seems to be showing over the top of the tableview.
I want the status bar to show, with the tableview directly underneath. Can anyone tell me how to do this?
Screenshot of the problem
Thanks y'all!
this is status bar issue.
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)
{
self.edgesForExtendedLayout=NO;
}
or
In your Appdelegate
if (SYSTEM_VERSION_LESS_THAN(#"7.0")) {
self.window=[[[UIApplication sharedApplication]delegate] window];
self.window.frame = CGRectMake(0,-20,self.window.frame.size.width,self.window.frame.size.height+20);
}
ios-7-uitableview-shows-under-status-bar
Related
i am using UIApplicationWillChangeStatusBarFrameNotification to tell when the status bar will change, and this does help me figure out when the call in progress goes away, and the behavior is as i would like.
however, there is one scene in my app in which i take the full screen, and that includes hiding the status bar … except that i would like to not hide the status bar when in a call.
my understanding is that the only way this status-bar will first show up is if i (a) get a phone call, then (b) return to my app.
so … when i return to my app upon receiving a phone call … there is no green status bar. (fwiw, the green status bar does appear when i tap on my app to make the status bar and nav bar and tab bar re-appear, so it's not that it is entirely gone; just hidden because i told it to be hidden. in the simulator, performing the "Hardware -> Toggle In-Call Status Bar" works as i would like, but i don't think this behavior will ever really occur this way in the real world.)
i found the answer to How do I get notified when a user opens my iPhone app while in a phone call? … but that only works if the statusBar is visible when my app is re-opened.
i want to know how to tell that i'm in a call when i return to my app so that i can manually unhide the green status bar while the user is looking at my scene that otherwise will hide the status bar.
my question is thus: is there an interface to tell me this information that i can query when i return to the app in applicationDidBecomeActive: or via some other sort of notification?
You can use CTCallCenter to find out if there is a current cell call. You and also register a handler with this class to be notified about cell state changes.
CTCallCenter *callCenter = [[CTCallCenter alloc] init];
// If no calls are in progress, the value of this property is nil.
if ([callCenter currentCalls] != nil) {
... call present...
}
[callCenter release];
I have a nice little app on the app store that does pretty well for itself. Life was great until iOS 5 came to town. Now, I have a number of issues with my app that I have no way of fixing because I have no clue what is going on, because I feel that they are iOS 5 issues, not mine.
Was there an iOS 5 conversion manual I missed? Or did they just change everything for fun, and want us to figure out where all the easter eggs were?
Here is another issue I am experiencing (that I have wasted so much time trying to fix), that DON'T EXIST AT ALL when I simply say that I want to run the app in good ol' 4.2:
Modal view
My app is a simple reader app. I have a book reading view that displays text with a UIWebView. One of the features I have been working on involves the ability to take notes as you read. This is achieved by hitting a button, and presenting a modal view. Yes, a modal view. The most simple pre- iOS 5 thing you could possibly do. Now, when I dismiss my modal view, just by hitting cancel, and simply dismiss the view, when I get back to my reader view, the navigation bar at the top is pushed up half way off the screen! This doesn't happen in 4.2, but there it is in iOS 5!
What can I do to get this issue resolved?
Thanks for your help.
Ok, I was just able to figure out what in the blazes was going on. I had the shouldAutorotateToInterfaceOrientation value set to a BOOL variable, so that when the modalView was coming back, it didn't know the state/size of the status bar. Fixed that, and the problem disappeared.
I have the feeling it has something to do with the way you present and dismissing the modalview. Apple introduced a new method to present views. May you try using theses instead of the old ones and see if it fixes your problem.
So here is what you do:
change this method:
presentModalViewController:animated:
into the new preferred method introduced with iOS 5:
presentViewController:animated:completion:
Depending if you are using dismissModalViewControllerAnimated:to dismiss your view, change it into dismissViewControllerAnimated:completion.
This methods also have completion handler which is very useful to do some extra work after the view has been presented/dismissed. Maybe that also helps with your other issue. Let me know if that might helped.
A major change in iOS 5 is that the navigationController property of UIViewController is no longer set for modal views. Instead, there is a new (not present in iOS 4) parentViewController property. So where you're using navigationController in a modal view you need to change the logic to something like:
UIViewController* parent;
if ([self respondsToSelector:#selector(parentViewController)]) {
parent = self.parentViewController;
}
else {
parent = self.navigationController;
}
(That's from memory, so I can't guarantee that every t is dotted and every i crossed.)
I was seeing this same clipping problem.
I found out that the reason for my issue was that I set the content size within the modal dialog (something I did for my iPad layout), so removing these two lines seemed to fix the issue:
CGSize size = CGSizeMake(320, 480);
self.contentSizeForViewInPopover = size;
I thought the problem was fixed but it wasn't. After reviewing the code some more, cleaning the build, and retesting it turned out to be a shouldAutorotateToInterfaceOrientation which would return NO for all orientations, for a brief amount of time (flag == NO) while the app is loading (root controller). You want to at least return YES to one orientation like so:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return !self.flag ? UIInterfaceOrientationPortrait == toInterfaceOrientation : YES;
}
In my application, I have a UINavigationController with a UINavigationBar that I created programmatically. The UINavigationBar has custom positioning within the view, but whenever will/didChangeStatusBarFrame is called (when you enable the in-call status bar), or the app suspends and resumes, the navBar automagically moves back to the top of the screen.
I was able to override this behavior somewhat by keeping my navBar in place at the bottom, but now it creates a SECOND navBar which it moves to the top.
Why is this happening, and how do I prevent it from happening? This is a new issue with iOS 4 - the app ran fine in both 2.x and 3.x.
Also, before a discussion about Human Interface Guidelines is started, please note that I'm aware Apple doesn't want UINavigationBars at the bottom. However, this is a custom app that will be used by me and me alone, and I require that the bar be at the bottom. Additionally, this issue is driving me nuts and I want to know the answer no matter where my navBar lies...
Whelp, this is a bit of a hack, but it works.
To keep the navBar at the bottom when the in-call status is displayed:
- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame {
[navigationController setNavigationBarHidden:YES];
}
- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame {
[navigationController setNavigationBarHidden:NO];
CGSize s2 = navBar.bounds.size;
[navBar setFrame:CGRectMake(0, [navigationController.view bounds].size.height-s2.height, s2.width, s2.height)];
}
And since multitasking with this app is not only unnecessary but also unwanted, I disabled it by adding the following to the plist:
Application does not run in background
This still doesn't really answer my question about why the navBar was jumping to the top, and it's a hackish fix, but it will have to work for now.
I am using multiple controller during launch of an application in app delegate. One controller is for registration and the second controller is tabbar. tabbar was loading fine but when I pushed registration controller on window, contents went up by 20 units and I have good white blank screen at bottom. Therefore I recreated frame of my registration view controller in its viewdidload method and slided it 20 units down. The code is
self.view.frame = CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height);
and code in my app delegate for launch application was
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (![self accountExists]) {
//code if account does not exists on iphone app database
self.registerAccount = [[registerViewController alloc] initWithNibName:#"registerViewController" bundle:nil];
[window addSubview:registerAccount.view];
}
else if([self autoLoginForAnyAccount]){
//code for autologin to app
}
else {
self.tabBarController.selectedIndex = 1;
self.tabBarController.delegate = self;
[window addSubview:tabBarController.view];
}
[window makeKeyAndVisible];
return YES;
}
if anyone knows why there is a white space at bottom when registration controller is pushed then please share it with me.
Recently, I have passed through with the same problem. After referring so many blogs & Q&A forums, I found the white space problem is due to improper frame settings.
Below is the solution, that works very fine on my side...
[self.view setFrame:CGRectMake(0,0, self.view.bounds.size.width, self.view.bounds.size.height)];
Hope, this will help you out.
Regards,
iApple.
I figure out the issue but not the reason. Issue was size of the window i.e. In my code i was creating instance of registerViewController therefore its size was size of the window minus size of the status bar(since it is a view controller which must be displayed below status bar). When i pushed registerViewController onto window then because of some reason (i dont know why) view controller failed to recognize status bar in the header and 20px of registerViewController was displaying behind status bar. then I tried code registerAccount.view.frame = window.frame; which sets the frame of my registration controller equals to window controller. This removed blank white screen at the bottom and view now taking whole of the window size but still 20px was behind status bar since my view controller was blind to see existance of status bar. I tried to remove status bar using code which showed my whole controller on the screen but I wanted status bar at the top too.
I figure out my way by adding UIViewcontroller object in my mainWindow.xib file(just like my tab bar controller) and I pointed its class to be registerViewController and loaded nib of registerViewController. i also removed line self.registerAccount = [[registerViewController alloc] initWithNibName:#"registerViewController" bundle:nil];
and replaced in my delegate .h file registerViewController *registerAccount; with UIViewController *registerAccount; and in mainWindow.xib file I pointed my newly added view controller to this controller. Now everthing is working fine but I still dont know why viewcontroller failed to see status bar when I pushed instance of registerViewController.
if anyone knows the reason then please share here with me.
New view based project in XCode
Go to main.xib and view.xib respectively
In each case set status bar to none in attributes section for view
Not sure why it still shows both on simulator and on platform?
Have looked for something in code, but don't see what else is calling this?
Anybody know how to turn the status bar off?
Thanks // :)
Figured it out...
Using Snow Leopard and the XCode 3.2, you simply edit the Apps Info.plist.
Right click the open Info.plist and add a row.
Select "Status Bar Style" from the drop down list. In the column to the right type in UIStatusBarHidden.
To affect this more dynamically this can be used instead:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]; should hide the status bar.
// :)
The status bar off in interface builder does not make it go away, use UIApplications - (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated here http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/UIApplication/setStatusBarHidden:animated: