How do I make my app seamless from the default.png to my App? Should I load it somewhere else? FYI I only have an iPod Touch 2nd Gen for testing running 4.2.1(8C148) The 4.2 simulator does the same thing. 4.3 simulator works fine.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictio开发者_如何学Gonary *)launchOptions {
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:YES]]];
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
[self.window addSubview:viewController.view];
[self.window makeKeyAndVisible];
return YES;
}
What is happening it is taking a few seconds before UIWebView fully loads its content. So whilst it is loading, you are seeing the background color of the web view. If you don't want the blank screen, I would advise showing an activity indicator, to show that something is happening.
Alternatively, set the webViews delegate as your self and only perform [self.window makeKeyAndVisible]
in the webView' delegate message named `webView:didFinishLoad‘
The latter method is unadvisedly though, as your effectively delaying the start of your app for several seconds.
In viewDidLoad,
webView.delegate = self;
Now in a separate method, called -(void)webViewdidFinishLoad:(UIWebView *)theWebView
[imageView removeFromSuperview]
[imageView release]
精彩评论