I want to create a app with only one view(TestViewController.h TestViewController.m). (no Tabbar, no Navigation Bar) Don’t know why after i launch the app, the screen is totally black. It seems that the app did not load the view successfully? Since if the view is loaded, the screen should be white. Am I right or not?
Here’s AppDelegate.h
#import <UIKit/UIKit.h>
@class TestViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
UIWindow *window;
TestViewController *testrViewController;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) TestViewController *testViewController;
@end
Here’s AppDelegate.m
#import "AppDelegate.h"
#import "TestViewController.h"
@implementation AppDelegate
@synthesize window = window;
@synthesize testViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self.window addSubview:testViewController.view];
[self.window makeKeyAndVisible];
return YES;
}
if you are creating it programmatically, then you should also instantiate
windowthen your ViewController
and then make it visible