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
// 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
相关文章推荐
- iOS 获取当前经纬度
- IOS之UI  视图(笔记)
- ios 应用程序测试
- iOS 实现简单的界面切换
- ios开发 网络编程HTTP/FTP连接
- IOS 轻扫
- iOS 根据字体和文字来…
- iOS MVC模式已死?何不试试MOVE
- iOS SBJson解析,拼接的用法
- ios 对象间的通信
- ios 分享到新浪微博(底层实现)
- ios 关于手机通讯录
- iOS 代码设置自动布局
- arcgis api for IOS版本更新
- iOS 不同版本不同行为的另一种宝法
- iOS下载文件,保存路径. 防止…
- iOS学习之Table View的简单使用
- iOS 创建单例的两种方法
- IOS之UI UITextField、UILabe…