MultiTouchDemoViewController.m.svn-base
上传用户:huachun008
上传日期:2009-10-03
资源大小:1927k
文件大小:2k
源码类别:

MacOS编程

开发平台:

Objective-C

  1. //
  2. //  MultiTouchDemoAppDelegate.m
  3. //  MultiTouchDemo
  4. //
  5. //  Created by Jason Beaver on 5/29/08.
  6. //  Copyright Apple Inc. 2008. All rights reserved.
  7. //
  8. #import "MultiTouchDemoViewController.h"
  9. #import "TouchImageView.h"
  10. #define IMAGE_WIDTH 200.0
  11. @implementation MultiTouchDemoViewController
  12. - (void)viewDidLoad
  13. {
  14. [super viewDidLoad];
  15.     
  16.     self.view.backgroundColor = [UIColor whiteColor];
  17.     UIImage *image = [UIImage imageNamed:@"Flowing Rock.png"];
  18.     CGRect imageRect = CGRectMake(0.0, 0.0, IMAGE_WIDTH, 0.0);
  19.     imageRect.size.height = IMAGE_WIDTH * image.size.height / image.size.width;
  20.     TouchImageView *touchImageView = [[TouchImageView alloc] initWithFrame:imageRect];
  21.     touchImageView.image = image;
  22.     touchImageView.center = CGPointMake(160.0, 230.0);
  23.     [self.view addSubview:touchImageView];
  24.     [touchImageView release];
  25.     image = [UIImage imageNamed:@"Clown Fish.png"];
  26.     imageRect.size.height = IMAGE_WIDTH * image.size.height / image.size.width;
  27.     touchImageView = [[TouchImageView alloc] initWithFrame:imageRect];
  28.     touchImageView.image = image;
  29.     touchImageView.center = CGPointMake(160.0, 85.0);
  30.     [self.view addSubview:touchImageView];
  31.     [touchImageView release];
  32.     image = [UIImage imageNamed:@"Stones.png"];
  33.     imageRect.size.height = IMAGE_WIDTH * image.size.height / image.size.width;
  34.     touchImageView = [[TouchImageView alloc] initWithFrame:imageRect];
  35.     touchImageView.image = image;
  36.     touchImageView.center = CGPointMake(160.0, 375.0);
  37.     [self.view addSubview:touchImageView];
  38.     [touchImageView release];
  39. }
  40. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  41. {
  42.     return YES;
  43. }
  44. @end