minivmac4ios/Mini vMac/ViewController.m
2016-05-11 23:13:42 +02:00

48 lines
1.1 KiB
Objective-C

//
// ViewController.m
// Mini vMac
//
// Created by Jesús A. Álvarez on 27/04/2016.
// Copyright © 2016 namedfork. All rights reserved.
//
#import "ViewController.h"
#import "TouchScreen.h"
#import "AppDelegate.h"
@interface ViewController ()
@end
@implementation ViewController
{
UIControl *pointingDeviceView;
}
- (BOOL)prefersStatusBarHidden {
return YES;
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self setUpPointingDevice];
}
- (void)setUpPointingDevice {
if (pointingDeviceView) {
[pointingDeviceView removeFromSuperview];
pointingDeviceView = nil;
}
pointingDeviceView = [[TouchScreen alloc] initWithFrame:self.view.bounds];
pointingDeviceView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view insertSubview:pointingDeviceView aboveSubview:self.screenView];
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (motion == UIEventSubtypeMotionShake) {
[[AppDelegate sharedInstance] showInsertDisk:self];
}
}
@end