2012-03-23 15 views
5

एनीमेशन के साथ एक और समस्या शीर्ष पर यह पैमाने पर और निचले बाएं से बढ़ रही है, कुछ हद तक यह आंकड़ा के लिए इसी तरह की तरह दिखाने के बनाने के लिए छोड़ दिया कुछ एनिमेशन की कोशिश की लेकिन मैं जिस तरह से चाहता हूं उसे प्राप्त करने में सक्षम नहीं हूं। कृपया सुझाव दें। वर्तमान में निम्नलिखित कोड का उपयोग कर पैमाने पर करने के:CALayer पैमाने एनीमेशन एक परत पर सही

layer.anchorPoint = CGPointMake(1, 1); 
CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 
[scale setFromValue:[NSNumber numberWithFloat:0.0f]]; 
[scale setToValue:[NSNumber numberWithFloat:1.0f]]; 
[scale setDuration:1.0f]; 
[scale setRemovedOnCompletion:NO]; 
[scale setFillMode:kCAFillModeForwards]; 
+1

सिर्फ मेरे सवाल का संपादन किया। – Amit

उत्तर

6

आप उस प्रभाव हासिल करने के लिए एक अलग anchorPoint स्थापित करना चाहिए।

layer.anchorPoint = CGPointMake(0.0f, 1.0f); 
1

यह सब मेरे लिए काम नहीं करता है। तरीके कि फ्रेम और

- (CGRect) fixRect:(CGRect)rect inRect:(CGRect)container 
{ 
    CGRect frame = rect; 
    frame.origin.y = container.size.height - frame.origin.y - frame.size.height; 
    return frame; 
} 
- (CGPoint) fixPoint:(CGPoint)point fromPoint:(CGSize)containerSize 
{ 
    CGPoint frame = point; 
    frame.y = size.height - frame.y; 
    return frame; 
} 
1

अंक फिक्सिंग मुझे आशा है कि यह आपकी मदद कर सकते हैं:

let frame = pathView.frame 
let anchorPoint = CGPointMake(0, 1) //Set the animation direction 
let position = CGPointMake(frame.origin.x + anchorPoint.x * frame.size.width, frame.origin.y + anchorPoint.y * frame.size.height) 
pathView.layer.anchorPoint = anchorPoint 
pathView.layer.position = position 
UIView.animateWithDuration(0.8){() -> Void in 
    pathView.layer.transform = CATransform3DMakeScale(0.5, 0.5, 1) 
} 
संबंधित मुद्दे