I carefully followed the instructions in ch. 6 under “Zooming”, and get no warnings or errors, but I am unable to zoom in the iOS simulator. The little “finger points” appear and move around, but don’t cause any zooming to happen. Any ideas?
Perhaps not that intuitive - you still need to (left) click too
I did click with the mouse and moved it around while holding the “Alt” key, but no zooming.
OK, didn’t think it would be that obvious
Post your listing? Probably just missed something – easily done with this chapter as it goes from panning to zooming by changing the code you just added. There’s an added instance variable too that points to the view for zooming.
In HypnosisterAppDelegate.h I have:
@interface HypnosisterAppDelegate : UIResponder <UIApplicationDelegate, UIScrollViewDelegate>
In HypnosisterAppDelegate.m I have:
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
[[UIApplication sharedApplication] setStatusBarHidden:YES
CGRect screenRect = [[self window] bounds];
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:screenRect];
[[self window] addSubview:scrollView];
CGRect bigRect = screenRect;
view = [[HypnosisView alloc] initWithFrame:screenRect];
BOOL success = [view becomeFirstResponder];
NSLog(@“HypnosisView became the first responder”);
NSLog(@“Could not become first responder”);
self.window.backgroundColor = [UIColor whiteColor];
(UIView *)viewforZoomingInScrollView:(UIScrollView *)scrollView
...has a typo :slight_smile: The 'f' in 'for' is lowercase, doesn't match the delegate method. Change it to 'For' and it works.
…has a typo The ‘f’ in ‘for’ is lowercase, doesn’t match the delegate method. Change it to ‘For’ and it works.
You’re right, that does work. It’d be kind of nice if that sort of thing generated a warning, but of course you can name a new method what you want to. o_O
Thanks for your help!