Enable iOS notification center, but keep the status bar hidden? - ios

I want my application to not show the iOS status bar. I can do this in AppDelegate.m like so:
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
application.statusBarHidden = YES;
return YES;
}
This hides the status bar great, but makes the iOS notification center and the iOS control center take 2 swipes to pull in. I do not want this behavior.
Any help would be fantastic. Thanks!

I'm sorry for the half-hearted answer, but I don't have enough rep to comment. Basically your app thinks it's in fullscreen mode, and that requires a 'double' swipe to bring up control center og notif-center. So you'll have to find a way to overwrite that default fullscreen behaviour

Related

Detect Blue flashing status bar in ios programmatically

When google map is using location service and we go to background then one status bar with blue flashing background with information "Google map is using your location" is coming.
Now when I open my application (or any other application) you always see that blue flashing bar .
My question is can I detect that status bar is with blue flashing information is active now or not programmatically?
UIApplicationDelegate has these 2 methods
- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame; // in screen coordinates
- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame;
You can refer this link for more details.
Detecting if user has in call / Any Activity status bar
Hopefully, it'll help you.Thanks.

Black background when view rotates on orientation change

I am fiddling with an orientation change responsive app in Xcode and am trying to figure out how I can change that my non-black view seems to rotate on a black background on orientation change!
It looks something like this:
I would like to change the black background to the colour of my view - which is pink in the depicted case.
When my app launches it also shows a black screen until the actual view appears. I have the feeling that it is the same black that becomes visible on orientation change?
I have tried to change the background colour of the window in the did-finish-launching method of my app delegate, but that did not have any effect:
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window.backgroundColor = [UIColor purpleColor];
...
}
Any suggestions?
Try using willAnimateRotationToInterfaceOrientation:duration: method instead of willRotateToInterfaceOrientation:duration:
But I think nearly all of the apps in iOS show a glimpse of black background, it seems normal. In your case if it is for long time, try reducing the duration time.
Also check this Stackoverflow Post

Adding view controller as launch screen

I am working on a launch screen where I want to add a progress bar.
LaunchScreen.xib doesn't allows me to add a progress bar on the launch screen.
So is it possible to add a view controller as the launch screen for some time interval so I can add a progress bar on the launch screen of my project?
No,you can not. You can not add any logic code to it.
And also know that, at launch screen time. Your app is not launched at all. So your code about progress bar is not running.
I think the better way is using a launch screen first,then show a viewController with a progress bar as you like.
Treat launch screen as progress indicator and do loading stuff before return "Yes" in applicationDidFinishLaunchingWithOption.as return yes line executed then view controller load it's view. but don't try too much stuff before return yes like time consuming network operation.
Yes, you can. I wanted to have control how long the LaunchScreen is visible when launching the app which I did in the didFinishLaunchingWithOptions in the AppDelegate.m file.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
int time = 3;
sleep(time);
printf("[%i] %s ***** sleeping %i seconds *****\n",__LINE__,__FUNCTION__, time);
return YES;
}

What exactly happens with app when user presses home button?

What exactly happens with an app when the user presses the home button? Does iOS make a snapshot of current app's state?
If I'm right, how to "slip in" another snapshot? I need it for showing the main iOS screen after user presses home button twice.
In order to achieve that, you could add a subview (i.e. ImageView with an image of your main screen) to your window in - (void)applicationDidEnterBackground:(UIApplication *)application.
When coming back (in - (void)applicationWillEnterForeground:(UIApplication *)application) you have to remove the subview.
However, Apple recommends to always show the latest state of the app (best user experience).
Example of AppDelegate implementation:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
/* other code */
self.overlayView = [[UIImageView alloc] initWithFrame:self.window.bounds];
self.overlayView.image = [UIImage imageNamed:#"mainscreen_screenshot.png"];
/* other code */
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[self.window addSubview:self.overlayView];
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[self.overlayView removeFromSuperview];
}
iOS takes screenshot before your application goes to background.
I got it from Apple's official documentation.
Remove sensitive information from views before moving to the background: When an app transitions to the background, the system takes a snapshot of the app’s main window, which it then presents briefly when transitioning your app back to the foreground. Before returning from your applicationDidEnterBackground: method, you should hide or obscure passwords and other sensitive personal information that might be captured as part of the snapshot.
So, Here We can hide our "sensitive personal information" and the system takes a snapshot of the app’s main window and we are not able to change its feature.
# sensitive personal information
Set a blurry screen overlay before the app goes in the background and once the app becomes active remove this overlay (check #cweinberger's answer).
If it is iOS 7 or later you can use the function ignoreSnapshotOnNextApplicationLaunch
Also, allowScreenShot flag can be explored in Restrictions Payload.
For deeply read about it Then this is the best documentation.

IOS 7 Status bar keeps appearing

I have used the two methods to remove the status bar ( the one with the time and the signal strength )but it keeps reappearing in my app for IOS 7
I have used the ' hide during application launch ' in GENERAL SETTINGS
I have added the ' status bar is initially hidden' BOOL to YES
I have changed the status bar to NONE in every View Controller
The problem occurs when i return after having accessed the IPHONE photo library to import a picture into my APP , and only then , it seems to override any previous entries in the PLIST
Does anyone have any code to permanently disable this status bar so it does not appear?
Thanks
* I have tried all the options listed but still when my app returns from opening and selecting from the photo gallery the status bar re-appears *
You need implement 2 steps for to hide status bar accross your app:
1) didFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[UIApplication sharedApplication]setStatusBarHidden:YES];
.......
}
2) And .plist file of your project
Add method in your view controller implementation.
- (BOOL)prefersStatusBarHidden {
return YES;
}
You can get rid of this by adding an entry in the .plist file of your project
"View controller-based status bar appearance" set its boolean value to "NO"

Resources