I'm developing an app for iOS 7 using Swift. My app has a login view in wich I use an UIImageView to set a background image. Everything works fine but when I test my app on an iphone 4 the status bar moves down the UIIMageView a little, as you can see in this image:
The UIImageView is positioned at y = 0(Align top to superview) and with and align center x equals to 0. The view mode is scale to fill.
The UIViewController that handles this view just control if the phone has internet connection and don't do anything with the UIImageView.
I tried to set the status bar hidden in the info settings of my project, also in the info.plist file and in the appdelegate when the app is launching by using the method setStatusBarHidden, but nothing works.
How I should deal with with the misplacement of the image, I don't care if I have to hide or not the status bar?
I have develop the my iPad application in ios6 but now i want to develop that application in ios7 also , I am using .xib file and I am not using the AutoLayout i want to use the black status bar in my application and i want to make the application similar like ios 6 but the status bar is overlap on the view i use the different code like below link
Link 1
Position of navigation bar for modal view - iOS7
Link 2
iOS 7 - Status bar overlaps the view
Thanks in Advance
wont happen, two options:
use a custom background image that is sized accordingly.. IIRC 44 (for navbar) + 20 (for status bar)
OR
account for the 20 pixels by using a custom view which is black :D
In iOS 7, the status bar is transparent, and other bars—that is, navigation bars, tab bars, toolbars, search bars, and scope bars—are translucent. As a general rule, you want to make sure that content fills the area behind the bars in your app.
Because the status bar is transparent, the view behind it shows through. The style of the status bar refers to the appearance of its content, which includes items such as time, battery charge, and Wi-Fi signal. Use a UIStatusBarStyle constant to specify whether the status bar content should be dark (UIStatusBarStyleDefault) or light (UIStatusBarStyleLightContent):
UIStatusBarStyleDefault displays dark content. Use when light content is behind the status bar.
UIStatusBarStyleLightContent displays light content. Use when dark content is behind the status bar.
In some cases, the background image for a navigation bar or a search bar can extend up behind the status bar. If there are no bars below the status bar, the content view should use the full height of the screen.
In iOS 7, you can control the style of the status bar from an individual view controller and change it while the app runs. If you prefer to opt out of this behaviour and set the status bar style by using the UIApplication statusBarStyle method, add the UIViewControllerBasedStatusBarAppearance key to an app’s Info.plist file and give it the value NO.
For more details about how to use status bar with navigation controller, please refer my answer here.
Try below to do not overwrite status bar:
[navController.navigationBar setBackgroundImage:[UIImage imageNamed:#"navBar.png"] forBarPosition:UIBarPositionTop barMetrics:UIBarMetricsDefault];
A workaround to use the old style status bar is to modify the frame of the main view and shift it down 20px. This will only work on viewWillAppear function but you need to make sure you call this once. This is more of a hack than a solution:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.view setFrame: CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y+20, self.view.frame.size.width, self.view.frame.size.height-20)];
}
on the iphone, when internet sharing is activated and another device is connected, a bar appear under the status bar. It makes the current view of the active app go down for some more 20 pixels.
I'd like to rearrange controls in my view when this new bar appears.
How can i detect when it becomes visible?
These other SO questions should point you down the right path:
How to position view below green bar during phone call?
Resize for in-call status bar?
Edit
After further testing, it appears that the part of my button that are not clickable are where the status bar used to be. I'm hiding the status bar with :
// -- Override point for customization after app launch
[[UIApplication sharedApplication] setStatusBarHidden:YES];
Also added the Boolean value to my *-info.plist file:
UIStatusBarHidden=true
Which is awesome because it hides the status bar even as the window animates up. But it's still receiving touches. Any idea on how to disable this?
Original Post
Is there's a bounding box on an application that receives touch events? I created a few sample round rect buttons and placed them in different places in my view. The ones in the center of the view receive touch events (and show the highlighted blue color) but if I place a button near the edges of the view, only parts of them are clickable in the simulator. Is this because of Apples style guidelines? I placed a button exactly where a UITabNavigationItem would appear and only the bottom half of it is clickable.
Simulator has a bug with clickability of the former status bar area. Test on the real device.
I gave my iPhone app a black status bar by adding the UIStatusBarStyleOpaqueBlack / UIStatusBarStyle to the Info.plist file. It works great most of the time. The black status bar shows when the app is running and when the Default.png is being shown.
The issue is when I quit the app by pressing the home button, the status bar becomes a white block while the iPhone's standard quit animation is taking place. I haven't seen this issue with any other apps that use a black status bar.
Am I missing something?
Set the background color of your window to black.
[self.view.window setBackgroundColor:[UIColor blackColor]];