0
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
NSSet *allTouches = [[event allTouches] retain];
switch ([allTouches count])
{
case 1: {
UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
CGPoint touchPoint = [touch locationInView:[self view]];
if(touchPoint.x > rightleg.frame.origin.x && touchPoint.x < rightleg.frame.origin.x + rightleg.frame.size.width &&
touchPoint.y > rightleg.frame.origin.y && touchPoint.y < rightleg.frame.origin.y + rightleg.frame.size.height){
rightleg.alpha = rightleg.alpha + 0.005;
}
}
case 2 :{
UITouch *touch = [[allTouches allObjects] objectAtIndex:0];
CGPoint touchPoint = [touch locationInView:[self view]];
if(touchPoint.x > leftleg.frame.origin.x && touchPoint.x < leftleg.frame.origin.x + leftleg.frame.size.width &&
touchPoint.y > leftleg.frame.origin.y && touchPoint.y < leftleg.frame.origin.y + leftleg.frame.size.height){
leftleg.alpha = leftleg.alpha + 0.005;
}
}
}
}
當用戶觸摸圖像時,此代碼在UIImage上設置爲alpha,但是如何在觸摸該像素時在UIImage中的像素上設置alpha?iPhone:UIImage中如何設置Alpha觸摸PIxel?
感謝,對於這個答案非常有幫助! – sarak 2012-01-04 02:18:03