Phonegap - How do i make the statusbar black? - iphone

Pretty simple one that I just seemingly can't find the answer to.
How can i change the iPhone statusbar (thin bar right at the top with the reception/batter etc) from default grey to black in my PhoneGap iPhone application?
Thanks,
Glen

A PhoneGap-iPhone application is just a regular Xcode iPhone project.
Add UIStatusBarStyle:UIStatusBarStyleBlackOpaque to your Info.plist.
Open your Xcode project (e.g. MyApp.xcodeproj)
Open your Info.plist file (e.g. MyApp-Info.plist)
Add a new row:
Key: Status bar style
Value: Opaque black style
If you are viewing the RAW Key/Value pairs, then use:
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
You can right-click in MyApp-Info.plist to toggle the RAW Key/Value pairs.

just set
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;

When a PhoneGap Project is created, there is an <ApplicationName>AppDelegate.m file created in the project.
Inside of the (void)viewDidLoad method, you can make modifications to the view however you choose.

Related

Xcode 7 - Launch Screen localization doesn't work

I've created a splash screen in Swift using Xcode 7. I've generated localizations as in the photo for different languages, but it doesn't work:
Can anybody help?
Ok I fix it after i create InfoPlist.strings and create splash screen for each language and add below in each file
"UILaunchStoryboardName" = "LaunchScreen";
"UILaunchStoryboardName" = "LaunchScreenSP";
Add two Launch Screen storyboards
You can find your info.plist added a key named "UILaunchStoryboardName"
Add an infoPlist.string file
Change the UILaunchStoryboardName = "ENLaunchScreen"; in your infoPlist.string to the name of storyboard you wanted
Another solution, you can set some basic image at the launch screen, then create a view in app delegate and add in to window's subviews, also bring to front pretend that this is Launch screen.
now you can configure this view by code.
last use DispatchQueue asyncAfter to remove this view.

How To Port an iPhone Application to the iPad (Storyboard)

I just finished my iPhone app and I want to make it Universal. I've read a few posts already but they're a bit old (2010 or so).
What I got:
Simple iPhone app, recently created (iOS 5 - Storyboard), with three screens.
My app represents a table with three cards that you can flip touching them. The user can input (on the second screen) text to be displayed on the cards.
When I created the project I checked "Universal" so I have two Storyboards. After that nothing else I did had to do with iPad (except for a line on my "contact support" email option where I used UIModalPresentationPageSheet).
What I'd like to accomplish:
Same app on the iPad: my application is so straightforward I don't have any use for split views or details. I just want the same objects and layout but with bigger and better graphics (table, cards, etc).
I like it because it'd make a great introduction-level migration.
I have no idea where to start. When I run the iPad simulator a white screen comes up and that's it.
Well this is done.
As with almost everything, this is pretty easy once you know what to do.
I'd say that for those cases like mine, where the UI doesn't change in more than sizes or (x,y) coordinates the process could be summarized like this:
Replicate every UI element on the iPad Storyboard (copy and paste will do) and adjust position and size as you see fit
Re-wire everything again. Every button, segue (you'll have to add the segue name again too), etc.
Verify within your code every place where your UI is affected (e.g. x,y coordinates), identify whether the app is running on an iPhone or iPad, and divide your code accordingly
If you have any localization on the application you'll have to update the new UI elements on the iPad Storyboard
Select the target for testing on the simulator and try it out
In order to identify in which device the app is running you can use the following:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
//I'm running on the iPad
} else {
//I'm running on the iPhone
}
And that's it. Again, in a simple case like mine the reuse of code is absolute (100%), the new code you'll have to add is minimum (basically IF statements where needed), and the UI elements duplication is as easy as copy and paste.
I hope this is useful to someone else and if you have recommendations to improve this they're more than welcomed.
Open the Storyboard file in finder,Copy your iPhone-Storyboard and rename it Main-iPad.storyboard
Inside xCode, right click on the storyboard -> “open as” -> “Source Code”
Search for targetRuntime="iOS.CocoaTouch"and make it targetRuntime="iOS.CocoaTouch.iPad"
Now save everything and reopen Xcode -> the iPad-Storyboard contains the same as the iPhone-file but everyting could be disarranged you have to arrange it by your self.
Finally to get the iPad format also change the code in the MainStoryboard_iPad.storyboard from: to
Then go to your "StroryBoardEx-Info.plist" file,search for "Main nib file base name (iPad)" and make it "Main-iPad.storyboard"
If you just want to reuse your iphone storyboard, just go to your project settings. In TARGETS tab Info, there are rows 'Main storyboard file base name' and 'Main storyboard file base name (iPad)'. Just edit the iPad one to have the same value as the other. In my case I had to edit it as 'Main storyboard file base name (iPad)' with value 'MainStoryboard_iPhone'.

Adding iPad XIB to a View Based Application Template Application in XCode 4

I've created a View Based Application in XCode4; when creating the application I selected iPhone as the Device Family:
The application was created with the following files:
I designed the UI on the TestushViewController.xib file and without adding any code in the Delegate files, the application is uploading immediately to the TestushViewController.xib view and I'm very happy about it.
Now I want to add an iPad xib. How do I do that?
(I knew how to do it in XCode 3, but I used some code in the Delegate file, and now if I try to use the same code it doesn't work because the template default implementation works differently - Apple uses #class TestushViewController and self.window.rootViewController = self.viewController and it goes directly to the iPhone.xib. I don't know how to go around it without changing the entire thing to the way it was done in XCode3)
You'll need to structure your code in a similar way that the Window Template does. The file structure that template uses when the "Universal" option is ticked at creation is:
App Name/
AppNameAppDelegate
iPhone/
AppNameAppDelegate_iPhone
MainWindow_iPhone.xib
iPad/
AppNameAppDelegate_iPad
MainWindow_iPad.xib
The iPhone and iPad AppDelegates are simply subclasses of the AppNameAppDelegate
#interface YourAppNameAppDelegate_iPhone : YourAppNameAppDelegate {}
In your target summary you can set what .xib file is initially loaded for each device. It is called the "Main Interface" and has a pulldown menu.
Quite frankly, if you're wanting to do a universal app (iPhone + iPad) it's probably easier just to start with the Window Template and add in your view controllers instead of starting with the View template and trying to change it up.

Is it possible to prevent the iPhone from adding the 'shine' to my app's icon?

When you define an icon for your app in XCode and then run it in the simulator or on a real device, the icon is automatically trimmed so it has rounded edges and a 'glossy' sheen is applied over top of the icon. I'd like to get rid of that sheen since it's obscuring some of the detail in my icon. It seems like some other apps are able to accomplish this... anyone know how it's done?
Add this key/value pair to your Info.plist file:
<key>UIPrerenderedIcon</key>
<true/>
In Xcode 4.3 it's even easier...just go to your Target settings -> summary and next to your app icons check "Prerendered" - it removes that sheen

Why is the Status Bar STILL showing during Default.png?

I'm pretty sure that I've taken all steps to correctly set my status bar to hidden. I did this in both the info.plist file (setting a UIStatusBarHidden to a boolean TRUE) as well as in the applicationDidFinishLaunching method in the Application Delegate using:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
And the status bar does hide -- only not quick enough. Despite the steps taken above, when the app is launched, the status bar is STILL being displayed for about a second during the displaying of the Default.png default image. This looks tacky, and I want to make sure the status bar does not get displayed at any time during the running of the app.
Many apps I've tried ARE hiding the status bar successfully (doesn't even show during the display of default.png) but I can't figure out how. Anyone deal with this issue before?
Did you figure this out already? What I did to get it to work is edit the Info.plist file in TextMate rather than in Xcode. I added the following two lines:
<key>UIStatusBarHidden</key>
<true/>
I think the only thing different from the answers given above is that I used a text editor rather than Xcode. When you subsequently look at Info.plist in Xcode, you will see a check mark next to UIStatusBarHidden rather than a string. There is probably a way to do this directly in Xcode, but I don't know what it is.
UIStatusBarHidden should be set to true.
in the info.plist there's also a key called "Status bar is initially hidden" that needs to be checked on. It will hide the status bar while loading the default.png
It's easier than that. At least in Xcode 4 you can simply add an entry "Status bar is initially hidden" to the plist and set its value to YES.
I was seeing a similar problem on an iPod Touch 2G (3.1.3), where a black rectangle - same dimensions as the status bar - was showing above the default.png.
The solution to this problem involved making the default.png image 320x480 as opposed to its original 640x960. The exact solution was to make a default#2x.png using the larger dimensions.
I have seen this on Jailbroken devices using IOS 2.1 with an older version of Cydia. In that instance, once Cydia was updated, the info.plist + ...statusBarHidden = YES method worked.
Alternatively see if [application setStatusBarStyle: ...] helps.
-isdi-