I have an iOS project (not using Storyboards) that has 2 UITextField and 1 button (a login screen). When the user clicks the button, it launches a POST to the server that returns “1” if the user is in the database. And, then, goes to another screen.
The problem is, that screen show black. This is my code:
In requestFinished method:
if([responseString2 isEqualToString:(@"1")]){
termsViewController *termscreen=[[termsViewController alloc]init];
[[self navigationController] pushViewController:termscreen animated:YES];
}
In the delegate class, in the method initDiddidFinishLaunchingWithOptions:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[firstViewController alloc] initWithNibName:@"firstViewController" bundle:nil];
self.window.rootViewController = self.viewController;
//
UINavigationController *navcontroller= [[UINavigationController alloc]initWithRootViewController:self.viewController];
[[self window]setRootViewController:navcontroller];
[self.window makeKeyAndVisible];
return YES;
}
It goes to another screen, shows the navigation bar…but the screen is black. I am new to iphone developing, so probably will be missing something.
Can anyone help me?
Thanks in advance.
I guess you are not assigning the nib file with it. Try this:
I assume your view controller variable’s name to be
termsViewController, which you may change to fit your needs. I hope this helps. Happy coding 🙂