2012-02-02 17 views
6

पर एनीमेटेड मेरे पास एक एमकेमैप व्यू और कोड वाला ऐप है जिसे प्रत्येक बार नक्शा बदलता है (क्षेत्रडिड चेंजएनिएटेड में)। जब ऐप शुरू में लोड होता है, तो क्षेत्रडिड चेंजएनिमेटेड को पैन (स्वाइप), चुटकी, नल और बटन पर कॉल किया जाता है जो नक्शा निर्देशांक को स्पष्ट रूप से अपडेट करते हैं। अन्य विचारों को लोड करने और मानचित्र पर वापस आने के बाद क्षेत्रडिड चेंजएनिमेटेड केवल नल और बटन जो स्पष्ट रूप से मानचित्र को अपडेट करते हैं, के लिए बुलाया जाता है। नक्शा और चुटकी को पैनिंग अब क्षेत्र को कॉल करेंडिड चेंजएनिएटेड।MKMapView क्षेत्र को कॉल नहीं कर रहा हैडिड चेंज पैन

मैंने इस stackoverflow post पर देखा है जिसने इस समस्या को हल नहीं किया है। devforums और iphonedevsdk पर फ़ोरम पोस्ट भी काम नहीं कर पाए। क्या किसी को पता है कि इस मुद्दे का क्या कारण है? मैं MKMapView में कोई सबव्यूव नहीं जोड़ रहा हूं।

उत्तर

3

मैं नहीं चाहता था कि शुरू में यह इस तरह से करने के लिए, लेकिन यह (प्रश्न में पोस्ट devforums से लिया गया) अब तक कोई समस्या नहीं के साथ काम करने प्रकट होता है:

अपने शीर्षक के UIGestureRecognizerDelegate जोड़ें। अब संस्करण संख्या का चेक जोड़ने ... हम आईओएस 4 पर हैं, तो हम ऐसा कर सकते हैं:

if (NSFoundationVersionNumber >= 678.58){ 

     UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchGestureCaptured:)]; 
     pinch.delegate = self;   
     [mapView addGestureRecognizer:pinch]; 

     [pinch release]; 

     UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureCaptured:)]; 
     pan.delegate = self; 
     [mapView addGestureRecognizer:pan]; 

     [pan release]; 
} 

इशारों को संभालने के लिए जोड़े प्रतिनिधि तरीके:

#pragma mark - 
#pragma mark Gesture Recognizers 

- (void)pinchGestureCaptured:(UIPinchGestureRecognizer*)gesture{ 
    if(UIGestureRecognizerStateEnded == gesture.state){ 
     ///////////////////[self doWhatYouWouldDoInRegionDidChangeAnimated]; 
    } 
} 

- (void)panGestureCaptured:(UIPanGestureRecognizer*)gesture{ 

    if(UIGestureRecognizerStateEnded == gesture.state){ 
     ///////////////////[self doWhatYouWouldDoInRegionDidChangeAnimated]; 
    } 
} 

-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ 
    return YES; 
} 

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch: (UITouch *)touch{ 
    return YES; 
} 

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{ 
    return YES; 
} 
+0

होगा पर यह काम आईओएस 5 के बारे में भी क्या? –

+0

हां, मुझे आईओएस 4 और आईओएस 5 के साथ समस्या थी और यह दोनों पर काम करता है। – brendan

संबंधित मुद्दे