2011-09-14 15 views
6

का उपयोग करके स्लाइड आउट नहीं करता है मेरे पास एक UIView है जिसे geopointView कहा जाता है। जब मैं एक बटन (myButton) दबाया जाता हूं तो मैं मुख्य दृश्य फ्रेम पर इस UIview में स्लाइड को एनिमेट करना चाहता हूं। यदि MyButton फिर से दबाया जाता है तो UIview फ्रेम से बाहर स्लाइड करना चाहिए। myButton निम्न विधि कॉल "optionsCalled"UIView स्लाइड को एनिमेट करता है लेकिन ब्लॉक एनीमेशन विधि

-(void) optionsCalled 
{ 
if (![[self.view subviews] containsObject:geopointView] &&checkForGeopointViewAnimation ==0) { 

     [self.view addSubview:geopointView]; 
     geopointView.frame = CGRectMake(0,430,320,30); 
     [UIView animateWithDuration:0.3f 
         animations:^{ 
          geopointView.frame = CGRectMake(0, 350, 100, 80); 
         } 
         completion:^(BOOL finished){ 
          checkForGeopointViewAnimation = 1 ; 
         }]; 

    } 
    if ([[self.view subviews] containsObject:geopointView] && checkForGeopointViewAnimation ==1) 
    { 

     geopointView.frame = CGRectMake(0, 350, 100, 80); 
     [UIView animateWithDuration:0.3f 
         animations:^{ 
          geopointView.frame = CGRectMake(0,430,320,30); 
         } 
         completion:^(BOOL finished){ 
          checkForGeopointViewAnimation = 0 ; 
         }]; 

     [geopointView removeFromSuperview]; 

    } 

} 
यहाँ

checkForGeopointViewAnimation एक वैश्विक चर में स्लाइड सुनिश्चित करने के लिए और बाहर एक समय में कहा जाता है नहीं कर रहे हैं परिभाषित किया गया है।

इस कोड के साथ समस्या यह है कि UIview एनिमेटेड रूप से स्लाइड करता है लेकिन यह स्लाइड आउट एक्शन को एनिमेट नहीं करता है। यह सिर्फ मुख्य फ्रेम से गायब हो जाता है। क्या मुझे यहां किसी भी समय उपयोग करने की आवश्यकता है ताकि यूआईवीव कार्यों को जोड़ने और निकालने में देरी हो?

अग्रिम

उत्तर

5

में किसी भी मदद के लिए धन्यवाद एनीमेशन

+0

धन्यवाद यह इंगित करने के लिए बहुत कुछ .. – alekhine

+1

@amol_subhedar: कृपया उन सभी उत्तरों को वोट दें जो आपको प्रशंसा के प्रतीक के रूप में मदद करते हैं। – visakh7

4

हो सकता है कि आप इसके बजाय अपने पूरा होने के ब्लॉक में [geopointView removeFromSuperview]; कॉल करने की आवश्यकता पूरी होने के बाद [geopointView removeFromSuperview]; का प्रयास करें?

+0

आपके उत्तर के लिए धन्यवाद .. – alekhine

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