मैं यह कर होगा कैसे, सभी मैं करना चाहता हूँ iPhone के उन्मुखीकरण के आधार पर एक UIImageView
बारी बारी है।घुमाएँ UIImageView iPhone अभिविन्यास के आधार पर
8
A
उत्तर
18
आप आईबी के माध्यम से ऐसा कर सकते हैं, एक चित्र और में लैंडस्केप लेआउट के साथ एप्लिकेशन प्राप्त करने के लिए, या आप इसे प्रोग्राम के रूप में कर सकते हैं। यह प्रोग्रामेटिक तरीके से है।
उन्मुखीकरण के परिवर्तन पर सूचनाएं प्राप्त करने,
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged)
name:UIDeviceOrientationDidChangeNotification
object:nil];
का उपयोग करें और (इस पर ध्यान दें एक परियोजना और लाइनों का एक बहुत से copypasted है बाहर छोड़ दिया जाता है इस तरह एक समारोह जोड़ने के लिए, आप धुन करने की आवश्यकता होगी करने के लिए अपने विशिष्ट स्थिति के लिए परिवर्तन)
-(void)orientationChanged
{
UIDeviceOrientation o = [UIDevice currentDevice].orientation;
CGFloat angle = 0;
if (o == UIDeviceOrientationLandscapeLeft) angle = M_PI_2;
else if (o == UIDeviceOrientationLandscapeRight) angle = -M_PI_2;
else if (o == UIDeviceOrientationPortraitUpsideDown) angle = M_PI;
[UIView beginAnimations:@"rotate" context:nil];
[UIView setAnimationDuration:0.7];
self.rotateView.transform = CGAffineTransformRotate(
CGAffineTransformMakeTranslation(
160.0f-self.rotateView.center.x,
240.0f-self.rotateView.center.y
),angle);
[UIView commitAnimations];
}
जब आप कर रहे हैं, इसलिए जैसे सूचनाएं बंद:
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] removeObserver:self];
संबंधित मुद्दे
- 1. iphone UIImageView रोटेशन
- 2. घुमाएँ दृश्य
- 3. OpenCV में घुमाएँ VideoCapture एंड्रॉयड
- 4. UIImageView पर ज़ूम लूप
- 5. आईओएस CAKeyframeAnimation rotationMode UIImageView
- 6. आईपैड पर MPMediaPickerController अभिविन्यास
- 7. रनटाइम पर अभिविन्यास बदलें
- 8. आईपैड एसडीके, UIImageView
- 9. UIImageView
- 10. UIImageView
- 11. UIImageView
- 12. UIImageView
- 13. UiImageView
- 14. UIImageView
- 15. UIImageView
- 16. UIImageView
- 17. UIImageView
- 18. UIImageView
- 19. UIImageView
- 20. UIImageView
- 21. UIImageView
- 22. UIImageView
- 23. UIImageView
- 24. एक iPhone पर
- 25. अभिविन्यास
- 26. आईपैड पर बल अभिविन्यास - जावास्क्रिप्ट
- 27. डिवाइस अभिविन्यास
- 28. फोन अभिविन्यास
- 29. iPhone sdk
- 30. उपयोगकर्ता के आधार पर jquery
हम्म, यह मेरे लिए पूरी तरह से काम करने के लिए के रूप में यह सिर्फ UIImageView/UIView जो एक और UIView अंदर है बारी बारी से नहीं होगा नहीं लगता है। इसके बजाय यह पूरे UIView को केवल उप-दृश्य को घुमाता है। – Joshua
तो 'self.rotateView' बस उप-दृश्य आपको घुमाया है करना चाहते हैं। – mvds
आपको 'M_PI/2.0f' के बजाय' M_PI_2' का उपयोग करना चाहिए –