I want to know the charge's percentage
When the application is char开发者_如何学Pythonging, the device use a few seconds for that... how can I know which is this charge's % Thank you!
Default.png will be displayed while your app get loaded, since your app isn't loaded yet no code can be executed.
You can display a loading bar after the appDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions is called.
If your app need any data loading, ex. loading a feed from the internet, you will be able to display a view controller in this methods which has a progress bar. Then when done loading just remove that view and display you normal root viewcontroller.
[UIDevice currentDevice].batteryLevel*100;
You can partially do this by the following technique (this is how a lot of apps work):
- in your applicationDidFinishLaunching method, do not add a view to your window
- in your MainWindow.xib, do not load anything
- everything that your app does which might take time to happen, put inside viewDidLoad methods in the relevant UIViewController subclasses
- very carefully make a simple loading bar / screen which you will display in applicationDidFinishLaunching
- asynchronous, launch a separate thread that will call "UIViewController.view" for each of your application views, and will update the main screen each time it finishes loading one
...because when you read from the .view property, it will cause iOS to immediately load in that NIB and all its associated files - images, objects, other NIBs, other views, other viewcontrollers, etc.
精彩评论