您的位置:首页 > 移动开发 > IOS开发

IOS 单机  双击

2013-09-22 14:23 281 查看
//

//  Movepu.m

//  UI_pull

//

//  Created by Ibokan on
12-8-23.

//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.

//

#import "Movepu.h"

@implementation Movepu

- (void)dealloc {

  
 

    [super dealloc];

}

//单机

- (void)viewiu

{

   float red= arc4random()%256;

   float green= arc4random()%253;

   float blue= arc4random()%133;

   self.backgroundColor=[UIColor
colorWithRed:red/255 green:green/255 blue:blue/255 alpha:1.0f];

 
  [UIView
beginAnimations:nil
context:NULL];

 
  [UIView
setAnimationDuration:2];

 
  [UIView
setAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:self
cache:YES];

 
  [UIView
commitAnimations];

}

//双击机

- (void)viewiu2

{

   float red= arc4random()%256;

   float green= arc4random()%253;

   float blue= arc4random()%133;

   self.backgroundColor=[UIColor
colorWithRed:red/255 green:green/255 blue:blue/255 alpha:1.0f];

 
  [UIView
beginAnimations:nil
context:NULL];

 
  [UIView
setAnimationDuration:2];

 
  [UIView
setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self cache:YES];

 
  [UIView
commitAnimations];

}

//开始

- (void)touchesBegan:(NSSet
*)touches withEvent:(UIEvent *)event

{

  
 

   UITouch *touch = [touches anyObject];

   UITouch *touch1 = [[event allTouches] anyObject];

   NSInteger numTaps=[touch1 tapCount];

   NSLog(@"%d",numTaps);

   switch (touch.tapCount) {

   
   case
1:

 
     
    [self performSelector:@selector(viewiu) withObject:nil afterDelay:0.5];

   
     
 break;

   
   case
2:{

 
     
    [self performSelector:@selector(viewiu2) withObject:nil afterDelay:0.5];

   
    }

   
     
 break;

   
   default:

   
     
 break;

    }

  
 

}

//移动

- (void)touchesMoved:(NSSet
*)touches withEvent:(UIEvent *)event

{

   
 

  
     

   
   UITouch *touch = [touches anyObject];

 
    // 
if (touch.tapCount==2) {

   
     
 self.center = [touch locationInView:self.window];

 
     
    [UIView beginAnimations:nil context:NULL];

 
     
    [UIView setAnimationDuration:0.3];

 
     
    // 
  [UIView
setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];

   
     
  [UIView commitAnimations];

   
 // 
}

   
 

}

//离开

-(void)touchesEnded:(NSSet
*)touches withEvent:(UIEvent *)event

{

   UITouch    
  *touch = [touches anyObject];

  
 

   if ([touch tapCount] ==
2) {

   
 

 
     
NSLog(@"2222222222");

    }

  
 

}

 

@end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: