I am getting a black screen whenever my app launches. There is no error message and I have set my main nib file in the .plist file. Here is some of my 开发者_开发技巧code.
AppDelegate.h
#import <UIKit/UIKit.h>
@class LoginController;
@interface ViiadAppDelegate : NSObject <UIApplicationDelegate> {
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet LoginController *viewController;
@end
AppDelegate.m
#import "AppDelegate.h"
#import "LoginController.h"
@implementation AppDelegate
@synthesize window=_window;
@synthesize viewController=_viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
Thanks in advance. I am new to iPhone development.
Since you changed the rootViewController of MainWindow, you have to make sure your MainWindow.xib view outlet is set to your new view controller.
In my case, I'd changed the Main Interface
in the Application Target Settings window. Restoring it to MainWindow
solved the problem.
Is this only when the app launches? You might be encountering the splashscreen, and since you have not loaded an image, the default is black. To change the splashscreen, add a profile image 320x480 named "default.png" to your project.
the black screen is the delay the app is taking to launch the UI. There are certain things you can do to speed this up.
you need to put a splash screen as mentioned by king popsicle. This is should not have any think that allows user interaction (maybe hide buttons or grey thme out in the image) so the user knows the app is loading but not loaded yet.
you should not have anything blocking (like a network connection) in your awake from nib function as that will block the main thread of execution
You could provide whats called "default" images. They are visible in the time that the application launches (handled automatically by iOS).
Here is the link where you could read more about it:
http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html
http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html
精彩评论