BallViewController.m
上传用户:jjjjag8
上传日期:2017-04-17
资源大小:1443k
文件大小:1k
- #import "BallViewController.h"
- #import "BallView.h"
- @implementation BallViewController
- - (void)viewDidLoad {
- UIAccelerometer *accelerometer = [UIAccelerometer sharedAccelerometer];
- accelerometer.delegate = self;
- accelerometer.updateInterval = kUpdateInterval;
- [super viewDidLoad];
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
- // Release anything that's not essential, such as cached data
- }
- - (void)dealloc {
- [super dealloc];
- }
- - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
-
- [(BallView *)self.view setAcceleration:acceleration];
- [(BallView *)self.view draw];
- }
- @end