UIStatusBarStyleBlackTranslucent does not work in iOS 6 - status

In iOS 6:
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
The status bar is shown in black, it is not in 0.5 alpha.
How to set the status bar to UIStatusBarStyleBlackTranslucent in iOS6 please?

If you are using storyboards, make sure that you tick "Wants Full Screen" in your view controllers. That will size your views so that it goes under the translucent status bar.
It looks like Xcode 4.5.2 is creating new view controllers in Storyboards with "Wants Full Screen" unchecked.

This code:
#ifdef __IPHONE_7_0
# define STATUS_STYLE UIStatusBarStyleLightContent
#else
# define STATUS_STYLE UIStatusBarStyleBlackTranslucent
#endif
[[UIApplication sharedApplication] setStatusBarStyle:STATUS_STYLE animated:YES];

Related

UIImagePickerController hiding status bar issue in iOS8

I did this
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
and it is great in iOS7, but iOS8 have some trouble with transitions in navigation bar between views and says:
Finishing up a navigation transition in an unexpected state.
Navigation Bar subview tree might get corrupted.
So, is any known solution to that?
Try this.
Make sure you have a delegate to the imagepicker.
imagePicker.delegate = self
now define this function
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[viewController prefersStatusBarHidden];
[viewController performSelector:#selector(setNeedsStatusBarAppearanceUpdate)];
}

UIButtons seem to have no effect on the other controls of my UI

I hope someone can help with this!
I have been following tutorials on how to build iOS applications and have downloaded an example project.
This project seems to run and compile for everyone else except me!
When I run the app in the simulator, none of the buttons or text fields work. There is no response and no errors.
Has anyone else had this issue?
FirstViewController.h
#import <UIKit/UIKit.h>
#interface FirstViewController : UIViewController {
UITextField *tempTextBox;
UILabel *calcResult;
}
#property (nonatomic, retain) IBOutlet UILabel *calcResult;
#property (nonatomic, retain) IBOutlet UITextField *tempTextBox;
- (IBAction) degreeConvert:(id)sender;
- (IBAction) backgroundTouchedHideKeyboard:(id)sender;
#end
FirstViewController.m
#import "FirstViewController.h"
#implementation FirstViewController
#synthesize tempTextBox, calcResult;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)degreeConvert:(id)sender
{
NSLog(#"IBAction triggered succesfully");
double fahren = [tempTextBox.text doubleValue];
double celcius = (fahren - 32) / 1.8;
[tempTextBox resignFirstResponder];
//create new string with celcius formatting
NSString *convertResult = [[NSString alloc] initWithFormat:#"Celcius:%f", celcius];
//output converted result to calcResult Label
calcResult.text = convertResult;
}
-(void) backgroundTouchedHideKeyboard:(id)sender
{
[tempTextBox resignFirstResponder];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.tempTextBox = nil;
self.calcResult=nil;
}
#end
Here you kill your controls in viewDidLoad:
self.tempTextBox = nil;
self.calcResult=nil;
Comment out those lines.
And it should work.
It sounds your buttons are not wired up to the code.
Two ways to find out:
1.) Open up the assistant view in Xcode (button top right, the little butler), Make sure the *.h file of the scene controller show up on the right and your scene on the left. Then hover the mouse over the littel gray circles that show up left of you IBAction lines. Then while you hover over the grey circles, the according button gets highlighted. See "onBtnProtocol" method below.
2.) When you see only the scene in interface builder (i.e. no Assistant View), select one of your buttons, then show up the Connection Inspector. Then you will see, if your button is connected to a method of your controller. See "Touch up Inside" line in the image below.
If wiring is OK from your poin of view, then put some
NSLog(#"Hey my IBAction was triggered");
log lines in your methods and see if the wiring REALLY works.
If it does not work, then come back with more detail.

UIImagePickerController in iOS 7 status bar

In io7,the status bar on top a view is a nightmare.Fortunally i managed to make it work so it will be placed above the view.I did it like this:
- (void)viewDidLoad
{
[super viewDidLoad];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
self.view.backgroundColor=[UIColor colorWithRed:(152/255.0) green:(204/255.0) blue:(51/255.0) alpha:1] ;
CGRect frame = self.topNav.frame; frame.origin.y = 20;
self.topNav.frame = frame;
}
....
}
Now my status bar is above my navigation bar.
But when it comes to calling UIImagePickerController things are different.The above code has no effect.
I tried to do this:
- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
CGRect frame = self.imagePickerController.frame; frame.origin.y = 20;
self.imagePickerController.frame = frame;
}
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
self.imagePickerController = imagePickerController;
self.imagePickerController.allowsEditing=YES;
....
}
and the result is:
Any chance that my status bar(when displaying the camera for taking pictures) above the camera controls?
Thank you.
I have same problem... and solve my proble...
Add The key in .plist file
'View controller-based status bar appearance' and set to NO.
And add in appDelegate.
[application setStatusBarHidden:NO];
[application setStatusBarStyle:UIStatusBarStyleDefault];
Note:- change the **setStatusBarStyle** according to your app background color
Set View controller-based status bar appearance' and set to NO.
And add in appDelegate.
[application setStatusBarHidden:NO];
[application setStatusBarStyle:UIStatusBarStyleDefault];
try this
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
In App's Info.plist file add:
"View controller-based status bar appearance" == NO
In appdelegae.m file,add following code in
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[application setStatusBarHidden:NO];
[application setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
}
This is a bug in iOS 7.0 and it's fixed in iOS 7.1

How to have full screen and hide toolbar/statusbar in Qt Quick app for Meego Device?

I am new to Meego development and my Qt Quick Application for Meego Device require to have full screen and not toolbar and no status bar. Also only for Portrait screen orientation.
I am using Pagestack for application navigation from one page to other. I got to be successful in locking to Portrait usiong Pagestack properties. But for toolbar and status bar no success. It has properties like
showStatusBar: false
showToolBar: false
But these are read only and could not help me to hide toolbar and status bar.
I just want to know how to make application using fullscreen or either way how to hide status bar and toolbar?
Even using following code in qmlapplicationviewer.cpp
void QmlApplicationViewer::showExpanded()
{
#ifdef Q_OS_SYMBIAN
showFullScreen();
#elif defined(Q_WS_MAEMO_5)
showMaximized();
#else
show();
#endif
}
so showMaximized() method to access not helping out yet.
I tried using this method in main.cpp file also like this
QWidget window;
window.showMaximized ();
But no results so for.
Any ideas would be highly appriciated.
Thank You
Try QWidget::showFullScreen().
You can control the toolbar via QML and the components. This article should help on how.
In the file: qmlapplicationviewer.cpp
change:
void QmlApplicationViewer::showExpanded()
{
#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
showFullScreen();
#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
showMaximized();
#else
show();
#endif
}
to:
void QmlApplicationViewer::showExpanded()
{
#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
showFullScreen();
#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
//showMaximized();
showFullScreen();
#else
//show();
showFullScreen();
#endif
}
Works great for me. Cheers.

Use custom background with UINavigationController default UIToolbar

I want to use my self background for my UIToolbar.
To do that with the UINavigationBar I've just used this category with the override of the drawRect method:
#implementation UIToolbar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: #"nm010400.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
#end
This piece of code works perfectly for the UINavigationBar but this does not work for the UIToolbar that is inncluded in the UINavigationController and enabled with this line o code:
self.navController.toolbarHidden = NO;
Can anyone help me with the problem? I' m sure that the UINavigationController use a standard UIToolbar so why this not works?!? thanks
To create custom UI elements there is no need to create categories anymore. With IOS 5 you can change the appearance of any UI element through the UIApperance protocol. You can change individual UI elements as normal but the real power comes when you are creating a themed application. Using this new protocol you can change the style of all instances of a particular UI element or even a UI element in a particular setting such as a UIBarButtonItem in a UINavigationController.
To change the appearance of all of the UINavigationBars in your application you can set the background like so,
[[UINavigationBar appearance]setBackgroundImage:[UIImage imageNamed:#"myNavBar.png"] forBarMetrics:UIBarMetricsDefault];
you change different attributes depending on which element you are using to change the title attributes of the UINavigationBar you can use,
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIFont fontWithName:#"MarkerFelt-Thin" size:24], UITextAttributeFont, nil]];
you can also use this on other UI elements so to change the background on all instances of the UIToolbar you can call
[[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:#"myToolBar.png"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
Hope this helps.
In your custom UINavigationController's viewDidLoad use the following code:
[self.toolbar setBackgroundImage:[UIImage imageNamed:#"mytoolbarbg.png"]
forToolbarPosition:1
barMetrics:UIBarMetricsDefault];

Resources