im using uigesturerecognizer transform view , workin perfectly, want use transform view width , height independently. way comes mind solve getting 2 finger positions , make if clause recognize if user trying increase width or height, need each finger position involved in pinch gesture. cant find method wondering if posible or if there alternative achieving this.
- (ibaction)handlepinch:(uipinchgesturerecognizer *)recognizer { recognizer.view.transform = cgaffinetransformscale(recognizer.view.transform, recognizer.scale, 1);//to transform height insted of width swap positions of second , third parameter. nslog(@"%f",recognizer.scale); recognizer.scale = 1; }
got answer if needs this, there method called location of touch. method can each touch x , y position. call when gesture recognizer state began because crashes if in state changed. save values in variables , go. hope helps interested.
- (ibaction)handlepinch:(uipinchgesturerecognizer *)recognizer { if(recognizer.state == uigesturerecognizerstatebegan){ nslog(@"pos : 0%f, %f",[recognizer locationoftouch:0 inview:self.view].x,[recognizer locationoftouch:0 inview:self.view].y); nslog(@"pos 1: %f, %f",[recognizer locationoftouch:1 inview:self.view].x,[recognizer locationoftouch:1 inview:self.view].y); } if(recognizer.state == uigesturerecognizerstatechanged){ recognizer.view.transform = cgaffinetransformscale(recognizer.view.transform, recognizer.scale, 1); //nslog(@"%f",recognizer.scale); recognizer.scale = 1; } if(recognizer.state == uigesturerecognizerstateended){ }
Comments
Post a Comment