मैंने मानक पिन की बजाय एप्लिकेशन में पिन छवियों का उपयोग किया है, अब मैं कस्टम पिन पर एनीमेशन (मानक पिन के साथ प्रभाव डालना) देना चाहता हूं। मैं कस्टम पिन छवियों को छोड़ने एनीमेशन प्रभाव कैसे प्रदान कर सकते हैं ????कस्टम पिन एनीमेशन - एमकेमैप व्यू
उत्तर
निम्नलिखित प्रतिनिधि विधि लागू करें।
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
MKAnnotationView *aV;
for (aV in views) {
CGRect endFrame = aV.frame;
aV.frame = CGRectMake(aV.frame.origin.x, aV.frame.origin.y - 230.0, aV.frame.size.width, aV.frame.size.height);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.45];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[aV setFrame:endFrame];
[UIView commitAnimations];
}
}
यह बहुत अच्छा काम किया। सही जवाब चिह्नित किया जाना चाहिए। –
यह यदि आप एक साथ सभी पिन ड्रॉप नहीं है, लेकिन एक छोटी सी देरी के साथ उनमें से प्रत्येक ड्रॉप इतना है कि यह दिखेगा पिन प्रभाव की बारिश होती है की तरह यह भी एक बहुत कूलर महसूस करता है। ऐप्पल ने मूल रूप से क्या किया है। इसका उपयोग करें:
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
MKAnnotationView *aV;
float delay = 0.00;
for (aV in views) {
CGRect endFrame = aV.frame;
aV.frame = CGRectMake(aV.frame.origin.x, aV.frame.origin.y - 430.0, aV.frame.size.width, aV.frame.size.height);
delay = delay + 0.01;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:delay];
[UIView setAnimationDuration:0.45];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[aV setFrame:endFrame];
[UIView commitAnimations];
}
}
हाँ यह अच्छा है! धन्यवाद – PrasadW
यह मेरे लिए अच्छा काम करता है। नहीं कर सकते याद जहां मैं इस पर यहां पाया हालांकि
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
MKAnnotationView *aV;
for (aV in views) {
// Don't pin drop if annotation is user location
if ([aV.annotation isKindOfClass:[MKUserLocation class]]) {
continue;
}
// Check if current annotation is inside visible map rect, else go to next one
MKMapPoint point = MKMapPointForCoordinate(aV.annotation.coordinate);
if (!MKMapRectContainsPoint(self.mapView.visibleMapRect, point)) {
continue;
}
CGRect endFrame = aV.frame;
// Move annotation out of view
aV.frame = CGRectMake(aV.frame.origin.x, aV.frame.origin.y - self.view.frame.size.height, aV.frame.size.width, aV.frame.size.height);
// Animate drop
[UIView animateWithDuration:0.3 delay:0.03*[views indexOfObject:aV] options:UIViewAnimationCurveLinear animations:^{
aV.frame = endFrame;
// Animate squash
}completion:^(BOOL finished){
if (finished) {
[UIView animateWithDuration:0.05 animations:^{
aV.transform = CGAffineTransformMakeScale(1.0, 0.8);
}completion:^(BOOL finished){
if (finished) {
[UIView animateWithDuration:0.5 animations:^{
aV.transform = CGAffineTransformIdentity;
}];
}
}];
}
}];
}
}
ध्यान दें कि एनोटेशन दृश्य एनिमेट -mapView:didAddAnnotationViews:
में अजीब प्रभाव का कारण बनता है जब MKMapView.userTrackingMode
MKUserTrackingModeFollowWithHeading
बराबर होती है। मेरी इच्छा है कि ऐप्पल ने MKAnnotationView
कक्षा में ड्रॉप ड्रॉप एनीमेशन उपलब्ध कराया है।
स्विफ्ट 3 ड्रॉप एनीमेशन
// animate annotation views drop
func mapView(_ mapView: MKMapView, didAdd views: [MKAnnotationView]) {
for annView in views {
// animate any annotation views except the user pin
if !(annView.annotation?.isKind(of: MKUserLocation.self))! {
let endFrame = annView.frame
annView.frame = endFrame.offsetBy(dx: 0, dy: -500)
UIView.animate(withDuration: 0.5, animations: {
annView.frame = endFrame
})
}
}
- 1. एमकेमैप व्यू: एनोटेशन पिन
- 2. एमकेमैप व्यू: एनोटेशन पिन के बजाय, एक कस्टम व्यू
- 3. एमकेमैप व्यू, एनिमेट्रॉप?
- 4. एमकेमैप व्यू initWithFrame एआरसी
- 5. आईओएस 6 एमकेमैप व्यू
- 6. यूआईसीओलेक्शन व्यू: एनीमेशन कस्टम लेआउट
- 7. एमकेमैप व्यू ज़ूम और क्षेत्र
- 8. अधिसूचना बार में एनीमेशन कस्टम व्यू
- 9. आईफोन एमकेमैप व्यू: मानचित्र पर सभी पिन दिखाने के लिए मानचित्र क्षेत्र सेट करें
- 10. पिन (एमकेमैप व्यू) पर केंद्र मानचित्र पर प्रयास कर रहे हैं
- 11. आईओएस मैपकिट कस्टम पिन
- 12. आईओएस 5 में एमकेमैप व्यू (आईओएस 6)
- 13. कभी-कभी आईओएस 6 एमकेमैप व्यू initWithFrame
- 14. एमकेमैप व्यू को एक्सेसरीज़ व्यू बटन जोड़ना एनोटेशन कॉल करें?
- 15. कस्टम सेग्यू एनीमेशन
- 16. कस्टम एनीमेशन
- 17. कस्टम एनीमेशन
- 18. कस्टम एनीमेशन
- 19. कस्टम ग्रिड व्यू
- 20. कस्टम व्यू नियंत्रक कस्टम segue
- 21. एंड्रॉइड लिस्ट व्यू एनीमेशन
- 22. आईफोन व्यू एनीमेशन
- 23. आईओएस व्यू 'फोल्डिंग' एनीमेशन
- 24. कस्टम एनोटेशन पिन परिवर्तन लंबे नल
- 25. व्यू-आधारित एनएसटीबल व्यू फ़िल्टरिंग + एनीमेशन
- 26. कस्टम व्यू
- 27. कस्टम व्यू
- 28. आईओएस 6 एमकेमैप व्यू क्रैश [ईएजीएलसीएन्टेक्स्ट सेटकंटेंट कॉन्टेक्स्ट]
- 29. आईफोन: एमकेमैप व्यू में टैप का पता लगाने
- 30. एमकेमैप व्यू क्षेत्रडिड चेंजएनिएटेड नहीं हमेशा कहा जाता है!
[यह मदद करनी चाहिए] (http://stackoverflow.com/questions/1857160/how-can-i-create-a-custom-pin-drop- एनीमेशन-उपयोग-mkannotationview) – dwery