Blank Simulator

OK Nevermind, something weird with the size of the simulator window. I scrolled up and the textbox and button showed up . No throwing the mac out the window for now…

Yaaay! I suppose that’s a good tip for anyone who encounters the same issue later: With Apple’s war on scrollbars, it’s not always obvious if the simulator is running in a scaled mode and may be hiding some content.

I’m working my way through Objective-C Programming 2nd Edition and after banging in the code on page 247 I have this same problem;i.e., the window appears with a white background color, but there’s nothing on that window. I’m a newbie with obj-c, if this problem has already been solved please direct me to the solution post - I can’t find it. My XCode is: Version 5.1 (5B130a). The simulator is: Version 7.1 (463.9.41). Thanks.

Look’s like I’m good now. I had the scrolling issue mentioned earlier and I also had to comment out one of the auto-generated lines:
// self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
Once I removed that line the items appeared in the window.

I have the same problem as the OP. When I press insert nothing happens, console empty as well. Keyboard is still there. This is my code:

BNRAppDelegate.h:

#import <UIKit/UIKit.h>

@interface BNRAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic) UITableView *taskTable;
@property (nonatomic) UITextField *taskField;
@property (nonatomic) UIButton *insertButton;

@property (nonatomic) NSMutableArray *tasks;

-(void)addTask:(id)sender;

BNRAppDelegate.m

[code]#import “BNRAppDelegate.h”

@implementation BNRAppDelegate

#pragma mark - Application delegate callbacks

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    CGRect winFrame = [[UIScreen mainScreen]bounds];
    UIWindow *theWindow = [[UIWindow alloc]initWithFrame];
    self.window = theWindow;
    CGRect tableFrame = CGRectMake(0, 80, winFrame.size.width, winFrame.size.height - 100);
    CGRect fieldFrame = CGRectMake(20, 40, 200, 31);
    CGRect buttonFrame = CGRectMake(228, 40, 72, 31);
    self.taskTable = [[UITableView alloc]initWithFrame:tableFrame style:UITableViewStylePlain];
    self.taskTable.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.taskTable registerClass:[UITableViewCell class] forCellReuseIdentifier:@“Cell”];
    self.taskField = [[UITextField alloc]initWithFrame:fieldFrame];
    self.taskField.borderStyle = UITextBorderStyleRoundedRect;
    self.taskField.placeholder = @“Type a task, tap Insert”;
    self.insertButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    self.insertButton.frame = buttonFrame;
    [self.insertButton setTitle:@“Insert” forState:UIControlStateNormal];

    [self.insertButton addTarget:self action:@selector(addTask:) forControlEvents:UIControlEventTouchUpOutside];

    [self.window addSubview:self.taskTable];
    [self.window addSubview:self.taskField];
    [self.window addSubview:self.insertButton];

    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    return YES;
    }

  • (void)applicationWillResignActive:(UIApplication *)application
    {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }

  • (void)applicationDidEnterBackground:(UIApplication *)application
    {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

  • (void)applicationWillEnterForeground:(UIApplication *)application
    {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }

  • (void)applicationDidBecomeActive:(UIApplication *)application
    {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

  • (void)applicationWillTerminate:(UIApplication *)application
    {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }

#pragma mark - Actions

-(void)addTask:(id)sender
{
NSString *text = [self.taskField text];
if ([text length] == 0)
{
return;
}

NSLog(@"Task entered: %@", text);
[self.taskField setText:@""];
[self.taskField resignFirstResponder];

}

@end
[/code]

found my mistake:

You have to use TouchUpInside not Outside.

I succeeded in first time, but this appeared in second time, so it must not be version problem.

Add the highlighted lines of code in your AppDelegate.m. It worked for me, hopefully it works out for you as well.

CGRect winFrame = [[UIScreen mainScreen] bounds];
UIWindow *theWindow = [[UIWindow alloc] initWithFrame];
self.window = theWindow;

[b][i]self.window.rootViewController = [[UIViewController alloc] init];[/i][/b]

This solved the problem for me, thank you!
Using Xcode 8.3.2, Simulator 10.0

This worked for me also, thank you!

worked to display but my UI is still unresponsive.