开发者

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):

  1. in your applicationDidFinishLaunching method, do not add a view to your window
  2. in your MainWindow.xib, do not load anything
  3. everything that your app does which might take time to happen, put inside viewDidLoad methods in the relevant UIViewController subclasses
  4. very carefully make a simple loading bar / screen which you will display in applicationDidFinishLaunching
  5. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜