पर सेट करता है, मैं अब कुछ समय के लिए मानचित्र प्रतिस्थापन पर काम कर रहा हूं। पूरी बात UIScrollView
के साथ CATiledLayer
द्वारा समर्थित है।UIScrollView setZoomScale लागू रोटेशन को शून्य
मेरे मानचित्र को घुमाने के लिए, मैं परत को घुमाता हूं। (CATransform3DMakeRotation
का उपयोग करते हुए) अब तक बहुत अच्छी तरह से काम करता है =)
लेकिन अगर मैं कभी setZoomScale
विधि CATransform3D
कि मेरी परत को प्रस्तुत किया 0.
मेरा प्रश्न है करने के लिए रोटेशन को रीसेट है जा रहा है कहते हैं, वहाँ है मेरे scrollView के zoomscale
को लागू रोटेशन को खोए बिना सेट करने का कोई तरीका?
चुटकी संकेतों के लिए एक ही समस्या मौजूद है।
// अतिरिक्त Infos
वर्तमान स्थिति के आसपास घुमाने के लिए, मैं लंगर बिंदु संपादित करने के लिए किया है। शायद यह स्केलिंग के लिए भी एक समस्या है।
- (void)correctLayerPosition {
CGPoint position = rootView.layer.position;
CGPoint anchorPoint = rootView.layer.anchorPoint;
CGRect bounds = rootView.bounds;
// 0.5, 0.5 is the default anchorPoint; calculate the difference
// and multiply by the bounds of the view
position.x = (0.5 * bounds.size.width) + (anchorPoint.x - 0.5) * bounds.size.width;
position.y = (0.5 * bounds.size.height) + (anchorPoint.y - 0.5) * bounds.size.height;
rootView.layer.position = position;
}
- (void)onFinishedUpdateLocation:(CLLocation *)newLocation {
if (stayOnCurrentLocation) {
[self scrollToCurrentPosition];
}
if (rotationEnabled) {
CGPoint anchorPoint = [currentConfig layerPointForLocation:newLocation];
anchorPoint.x = anchorPoint.x/rootView.bounds.size.width;
anchorPoint.y = anchorPoint.y/rootView.bounds.size.height;
rootView.layer.anchorPoint = anchorPoint;
[self correctLayerPosition];
}
}
हे बार्टोस, सबसे पहले, उस पोस्ट के लिए धन्यवाद! लेकिन यह मेरे लिए काम नहीं करता ... मैंने वर्तमान स्थिति के चारों ओर घूमने के लिए एंकर पॉइंट संपादित किया है। शायद यह समस्या है? मैं अपनी पोस्ट संपादित करूँगा और उस कोड को जोड़ूंगा। –
तो यह रोटेशन को बरकरार रखा, लेकिन रोटेशन अक्ष गलत था, है ना? –
मैं वास्तव में नहीं बता सकता। मैं जो देखता हूं उससे, यह एक अजीब बिंदु के आसपास घूमता है। लेकिन धुरी सही लगता है। –