Can't Scroll in iOS simulator


I can’t scroll in iOS Simulator. I’m not certain if I’m doing something wrong to scroll (I looked online and it said to point/click/drag with the mouse which is what I am doing) or if I screwed up entering the code from the book. Any help would be appreciated!

Here is the code I entered from the ‘Using UIScrollView’ section of the book.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    CGRect screenRect = [[self window] bounds];
    // Create the UIScrollView to have the size of the window, matching its size
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:screenRect];
    [[self window] addSubview:scrollView];
    // Create the HypnosisView with a fram that is twice the size of the screen
    CGRect bigRect = screenRect;
    bigRect.size.width *= 2.0;
    bigRect.size.height *= 2.0;
    HypnosisView *view = [[HypnosisView alloc] initWithFrame:bigRect];
    // Add the Hypnosis as a subview of the scrollView insted of the window
    [scrollView addSubview:view];
    // Tell the scrollView how big its virtual world is
    [scrollView setContentSize:bigRect.size];
    [[self window] addSubview:view];
    BOOL success = [view becomeFirstResponder];
    if (success) {
        NSLog(@"HypnosisView became the first responder.");
    } else {
        NSLog(@"Cound not become first responder.");
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;


The line causing the trouble is: [[self window] addSubview:view];

I copied your code into a test copy of the chapter, and found this line to be causing the trouble. I commented it out, and everything worked correctly.