To all I am using the
UITapGestureRecognizer*singleTap = [[[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doSingleTap:)] autorelease];
singleTap.numberOfTouchesRequired = 2;
[self.view addGestureRecognizer:singleTap
for getting the touch
And in doSingleTap: method i have this
-(void)doSingleTap:(UITapGestureRecognizer *)recognizer
{
CGPoint point = [recognizer locationOfTouch:0 inView:self.view];
NSLog(@"location X =>%f,location =>%f ",point.x,point.y);
CGPoint point1 = [recognizer locationOfTouch:1 inView:self.view];
NSLog(@"location X =>%f,location =>%f ",point1.x,point1.y);
NSLog(@"location X =>%f,location =>%f ",x,y);
UIView *test1 = [[UIView alloc]initWithFrame:CGRectMake(point.x, point1.y, x, y)];
test1.backgroundColor= [UIColor greenColor];
[self.view addSubview:test1];
}
getting the problem in adding the new view on the main view according to the finger location or position View is properly getting add on the view according to the position .
I want that view get add according to the two finger and automatically adjust their (x,y,w,h). I need help if any one help me Thanks in advance I google on this but didn't get any help
Compare with point.x and point1.x take lesser 1 as x and do same for y (compare with point.y and point1.y smaller 1 as y). take the difference between point.x and point1.x as width and do same for height (difference between point.y and point1.y) will sove the issue