में हमारे सिर को फिट करने के लिए लाइन समायोजित करना मैं हेयरट्री के रूप में एक ही एप्लीकेशन विकसित कर रहा हूं, सभी चीजें पूरी की जाती हैं। लेकिन समस्या निम्नलिखित छवि में प्रदर्शित होती है। मैं छवि में प्रदर्शन के अनुसार नीली रेखा का उपयोग कर ग्राहक चेहरे के अनुसार बाल शैली सेट करना चाहता हूं। मैं निम्नलिखित कोडimageview
testVw = [[UIView alloc]initWithFrame:CGRectMake(100,100, 100, 100)];
testVw.backgroundColor = [UIColor clearColor];
[self.view addSubview:testVw];
resizeVw = [[UIImageView alloc]initWithFrame:CGRectMake(testVw.frame.size.width-25, testVw.frame.size.height-25, 25, 25)];
resizeVw.backgroundColor = [UIColor clearColor];
resizeVw.userInteractionEnabled = YES;
resizeVw.image = [UIImage imageNamed:@"button_02.png" ];
[testVw addSubview:resizeVw];
UIPanGestureRecognizer* panResizeGesture = [[UIPanGestureRecognizer alloc]
initWithTarget:self action:@selector(resizeTranslate:)];
[testVw addGestureRecognizer:panResizeGesture];
resizeTranslate:
विधि का इस्तेमाल किया:
-(void)resizeTranslate:(UIPanGestureRecognizer *)recognizer
{
if ([recognizer state]== UIGestureRecognizerStateBegan)
{
prevPoint = [recognizer locationInView:testVw.superview];
[testVw setNeedsDisplay];
}
else if ([recognizer state] == UIGestureRecognizerStateChanged)
{
if (testVw.bounds.size.width < 20)
{
testVw.bounds = CGRectMake(testVw.bounds.origin.x, testVw.bounds.origin.y, 20,testVw.bounds.size.height);
imgvw.frame = CGRectMake(12, 12, testVw.bounds.size.width-24, testVw.bounds.size.height-27);
resizeVw.frame =CGRectMake(testVw.bounds.size.width-25, testVw.bounds.size.height-25, 25, 25);
rotateVw.frame = CGRectMake(0, testVw.bounds.size.height-25, 25, 25);
closeVw.frame = CGRectMake(0, 0, 25, 25);
}
if(testVw.bounds.size.height < 20)
{
testVw.bounds = CGRectMake(testVw.bounds.origin.x, testVw.bounds.origin.y, testVw.bounds.size.width, 20);
imgvw.frame = CGRectMake(12, 12, testVw.bounds.size.width-24, testVw.bounds.size.height-27);
resizeVw.frame =CGRectMake(testVw.bounds.size.width-25, testVw.bounds.size.height-25, 25, 25);
rotateVw.frame = CGRectMake(0, testVw.bounds.size.height-25, 25, 25);
closeVw.frame = CGRectMake(0, 0, 25, 25);
}
CGPoint point = [recognizer locationInView:testVw.superview];
float wChange = 0.0, hChange = 0.0;
wChange = (point.x - prevPoint.x); //Slow down increment
hChange = (point.y - prevPoint.y); //Slow down increment
testVw.bounds = CGRectMake(testVw.bounds.origin.x, testVw.bounds.origin.y, testVw.bounds.size.width + (wChange), testVw.bounds.size.height + (hChange));
imgvw.frame = CGRectMake(12, 12, testVw.bounds.size.width-24, testVw.bounds.size.height-27);
resizeVw.frame =CGRectMake(testVw.bounds.size.width-25, testVw.bounds.size.height-25, 25, 25);
rotateVw.frame = CGRectMake(0, testVw.bounds.size.height-25, 25, 25);
closeVw.frame = CGRectMake(0, 0, 25, 25);
prevPoint = [recognizer locationInView:testVw.superview];
[testVw setNeedsDisplay];
}
else if ([recognizer state] == UIGestureRecognizerStateEnded)
{
prevPoint = [recognizer locationInView:testVw.superview];
[testVw setNeedsDisplay];
}
}
इस कोड को पूर्ण दृश्य आकार बदला जा रहा। लेकिन मैं केवल उन हिस्सों का आकार बदलना चाहता हूं जो उंगली से चले गए हैं।
क्या आप मुझे जवाब दे सकते हैं? –
क्या आप वास्तव में पूछ रहे हैं? मुझे बहुत सारे कोड दिखाई देते हैं, लेकिन कोई स्पष्ट सवाल नहीं है! – Adam
ठीक है, हम नहीं जानते कि इस प्रभाव को कैसे बनाया जाए। कृपया HairTryOn iPhone ऐप इंस्टॉल करें। और बाल शैली प्रभाव देखें। यह भी देखें [http://stackoverflow.com/questions/15701125/split-the-image-into-a-mesh-of-small-quadrangles-in-opengles) –