2015-11-24 10 views
5

मेरे कोड के साथ एनिमेट नीचे है, लेकिन एनीमेशन सिर्फ तुरन्त अर्थात होता है दृश्य और दिखाई नहीं देता:अंक CATransform3DRotate

UIView *leftDoorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width /2, self.view.bounds.size.height)];  
leftDoorView.backgroundColor = [UIColor greenColor]; 
leftDoorView.layer.anchorPoint = CGPointMake(0.0, 0.5); 
[self.view addSubview:leftDoorView]; 

leftDoorView.center = CGPointMake(0.0, self.view.bounds.size.height/2.0); //compensate for anchor offset 

CATransform3D transform = CATransform3DIdentity; 
transform.m34 = -1.0f/500.0; 
transform = CATransform3DRotate(transform, M_PI_2, 0, 1, 0); 

[UIView animateWithDuration:1.0 animations:^{ 

     leftDoorView.layer.transform = transform; 
}]; 

यकीन है कि मैं गलत क्या कर रहा हूँ नहीं - किसी भी मदद कृपया सराहना की जाएगी।

+1

मैंने अभी आपके कोड को एक ऐप केडिडएपियर में कॉपी किया है, और यह एनीमेशन को सही तरीके से दिखाता है। –

उत्तर

3

यह मुद्दा अन्य विचारों की परतों के zPositions के रूप में सामने आया - संभवतः दृश्य पदानुक्रम में UITableView के कारण होने की संभावना है।

सेटअप एक UIViewController है जो एक शीर्षक UIImageView और UITableView को अपने दृश्य में देखने के लिए जोड़ता है। फिर एनीमेशन को अन्य विचारों के शीर्ष पर रहने के लिए जोड़ा जाता है। ऐसा लगता है कि UITableView किसी भी तरह परतों के zPositions को संशोधित करता है, इसलिए आखिरकार leftdoorView.layer.zPosition = 1000; को आजमाने के बाद और वास्तविक एनीमेशन को एक अलग चयनकर्ता को 0.2 सेकंड के बाद निष्पादित करने के बाद एनीमेशन दिखाया गया था।