署长
@interface TouchViewController : UIViewController {
IBOutlet UIView *viewImage;
IBOutlet UILabel *touchesLabel;
CGPoint lastPoint;
}
@property (nonatomic, retain) IBOutlet UIView *viewImage;
@property (nonatomic, retain) IBOutlet UILabel *touchesLabel;
-(void) redrawView:(CGPoint) lpoint;
@end
页: 1 执行档案
@implementation TouchViewController
@synthesize touchesLabel,viewImage;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
lastPoint = [touch locationInView:self.view];
[self redrawView:lastPoint];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
lastPoint = [touch locationInView:self.view];
[self redrawView:lastPoint];
}
-(void) redrawView:(CGPoint) lpoint
{
viewImage.frame=CGRectMake(lpoint.x, lpoint.y, 40, 30);
}
- (void)dealloc {
[viewImage release];
[touchesLabel release];
[super dealloc];
}
@end
* 说明:意见书 图像类型,但含有图像......有助于你如何上下台,以便如果你愿意,将我的项目上载。