- (
void
)viewDidLoad
{
[
super
viewDidLoad
];
UIView
*tempView
1
= [[[
UIView
alloc
]
initWithFrame
:
self
.view
.bounds
]
autorelease
];
[tempView
1
setBackgroundColor
:[
UIColor
blueColor
]];
[
self
.view
addSubview
:tempView
1
];
UIView
*tempView
2
= [[[
UIView
alloc
]
initWithFrame
:
self
.view
.bounds
]
autorelease
];
[tempView
2
setBackgroundColor
:[
UIColor
orangeColor
]];
[
self
.view
addSubview
:tempView
2
];
UITapGestureRecognizer
*tapGestureTel
1
= [[[
UITapGestureRecognizer
alloc
]initWithTarget:
self
action
:
@selector
(clickH:)]autorelease];
UITapGestureRecognizer
*tapGestureTel
2
= [[[
UITapGestureRecognizer
alloc
]initWithTarget:
self
action
:
@selector
(clickH:)]autorelease];
[tapGestureTel
2
setNumberOfTapsRequired
:
2
];
[tapGestureTel
2
setNumberOfTouchesRequired
:
1
];
[tapGestureTel
2
setNumberOfTapsRequired
:
2
];
[tapGestureTel
2
setNumberOfTouchesRequired
:
2
];
[tempView
1
addGestureRecognizer
:tapGestureTel
1
];
[tempView
2
addGestureRecognizer
:tapGestureTel
2
];
UISwipeGestureRecognizer
*oneFingerSwipeUp =
[[[
UISwipeGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(clickH:)]
autorelease
];
[oneFingerSwipeUp
setDirection
:UISwipeGestureRecognizerDirectionUp];
[tempView
2
addGestureRecognizer
:oneFingerSwipeUp];
UISwipeGestureRecognizer
*oneFingerSwipeDown =
[[[
UISwipeGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(clickH:)]
autorelease
];
[oneFingerSwipeDown
setDirection
:UISwipeGestureRecognizerDirectionDown];
[tempView
2
addGestureRecognizer
:oneFingerSwipeDown];
UIRotationGestureRecognizer
*twoFingersRotate =
[[[
UIRotationGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(clickH:)]
autorelease
];
[tempView
2
addGestureRecognizer
:twoFingersRotate];
UIPinchGestureRecognizer
*twoFingerPinch =
[[[
UIPinchGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(clickH:)]
autorelease
];
[tempView
2
addGestureRecognizer
:twoFingerPinch];
}
-(
IBAction
)clickH:(
id
)sender
{
UIView
*view = [[
self
.view
subviews
]
objectAtIndex
:
1
];
[
self
.view
insertSubview
:view
atIndex
:
0
];
}