için uygulanan rotasyon ayarlar. Her şey, CATiledLayer
tarafından desteklenen UIScrollView
ile çalışır. UIScrollView setZoomScale şimdi uzunca bir süre için bir harita yerine üzerinde çalışıyoruz geri Zero
(CATransform3DMakeRotation
Kullanılması) Ama şimdiye kadar setZoomScale
yöntem Sorum şu 0.
için rotasyon sıfırlıyor benim katmanına sunulacak gidiyor CATransform3D
ararsanız, orada Uyguladığınız rotasyonu kaybetmeden scrollView'ımın zoomscale
'u ayarlamanın herhangi bir yolu var mı?
aynı sorunu tutam hareketleri için mevcuttur. Geçerli Pozisyon etrafında döndürmek için Bilgiler
Ek
// i çapa noktasını düzenlemek zorunda. Belki de bu, ölçekleme için bir sorundur.- (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];
}
}
Hey Bartosz, her şeyden önce, bu yazı için teşekkürler! Ama bu benim için işe yaramadı ... Mevcut konumun etrafında dönmek için çapa noktasını düzenledim. Belki de sorun bu mu? Gönderiyi düzenleyip o kodu ekleyeceğim. –
Yani rotasyonu korudu, ancak dönüş ekseni yanlıştı, değil mi? –
Gerçekten söyleyemem. Sadece gördüğüm kadarıyla, garip bir nokta etrafında çok döner. Fakat eksen doğru görünüyor. –