// // HP16ViewController.m // HPcalc // // Created by Ken on 8/5/08. // Copyright 2008 Ken Staton. All rights reserved. // /* The UIScreen bounds behavior has changed in iOS8. Previously it would always give you width and height of the screen in portrait (so 320 x 568 on the iPhone 5), but in iOS8 it will give you width and height with respect to whatever orientation you're in, i.e. in landscape you would get 568 x 320. If you want to get the bounds in portrait (like before), use: [UIScreen mainScreen].fixedCoordinateSpace.bounds.size */ // landscape on iPhone 6: // 667 x 375 // 1334 x 750 (@2x) // landscape on iPadPro 9": // // landscape on iPhone 11pro: // 812 x 375 points // 1624 x 750 (@2x) #import "HP16ViewController.h" #import "HP16AppDelegate.h" #import "hpcalc.h" #import #import @implementation HP16ViewController -(void)calcInstance:(id)calc { thecalc = calc; } - (IBAction)keyPressed:(id)sender { NSInteger code = [sender tag]; NSLog(@"in vc keyPressed. key = %ld",(long)code); PowerState PWR = thecalc->_PWR; [thecalc processKeypress: (int)code]; [thecalc processKeypress: -1]; if (code == 24) { //NSLog(@"power button pressed %lu",(unsigned long)PWR); if (PWR == ON) { thecalc->_PWR=OFF;} else { thecalc->_PWR=ON;} } if (PWR == ON) { // key click only when "on" AudioServicesPlaySystemSound(1105); } } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Initialization code NSLog(@"initWithNibName"); } return self; } //Implement loadView if you want to create a view hierarchy programmatically /*- (void)loadView { [super loadView]; NSLog(@"loadview"); }*/ // If you need to do additional setup after loading the view, override viewDidLoad. - (void)viewDidLoad { [super viewDidLoad]; if (FALSE) { NSLog(@"transform_rotate"); CGAffineTransform transform = self.view.transform; //CGPoint center = CGPointMake(bounds.size.height / 2.0, bounds.size.width / 2.0); //CGPoint center = CGPointMake(667 / 4.0, 375 / 4.0); //CGPoint center = CGPointMake(812 / 2.0, 375 / 2.0); //CGPoint center = CGPointMake(1624 / 2.0, 750 / 2.0); CGPoint center = CGPointMake(375 / 2.0, 812 / 2.0); // Set the center point of the view to the center point of the window's content area. self.view.center = center; // Rotate the view 90 degrees around center point. transform = CGAffineTransformRotate(transform, (M_PI / 2.0)); self.view.transform = transform; } NSLog(@"viewDidLoad"); NSLog(@"H %f, W %f", [UIScreen mainScreen].fixedCoordinateSpace.bounds.size.height, [UIScreen mainScreen].fixedCoordinateSpace.bounds.size.width); } /* - (BOOL)shouldAutorotate:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations //return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); return NO; } */ - (UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview // Release anything that's not essential, such as cached data NSLog(@"Memory Warning"); } @end