2013-01-18 25 views
8

मैं एनीमेशन पूरा होने के बाद कोड का एक ब्लॉक चलाने के लिए चाहता हूं लेकिन संकलक निम्नलिखित त्रुटि दिखाता है: "void (^) (vOOL) प्रकार के पैरामीटर के लिए" असंगत ब्लॉक पॉइंटर प्रकार 'शून्य (^) (शून्य)' भेजना 'UIView संक्रमण के बाद कोड कैसे चलाएंविथव्यू?

यहां मेरा कोड है, मुझे यकीन नहीं है कि मैं क्या गलत कर रहा हूं, कृपया मदद करें, धन्यवाद।

[UIView transitionWithView:self.view duration:1.5 
        options:UIViewAnimationOptionTransitionFlipFromBottom //change to whatever animation you like 
       animations:^ { 
        [self.view addSubview:myImageView1]; 
        [self.view addSubview:myImageView2]; 
       } 
       completion:^ { 
        NSLog(@"Animations completed."); 
        // do something... 
       }]; 

उत्तर

12

आपके पास अभी गलत ब्लॉक प्रकार है :) इसे नीचे की तरह एक ब्लॉक की आवश्यकता है। कुंजी ^(BOOL finished) {...}

[UIView transitionWithView:self.view duration:1.5 
        options:UIViewAnimationOptionTransitionFlipFromBottom //change to whatever animation you like 
       animations:^ { 
        [self.view addSubview:myImageView1]; 
        [self.view addSubview:myImageView2]; 
       } 
       completion:^(BOOL finished){ 
        if (finished) { 
         // Successful 
        } 
        NSLog(@"Animations completed."); 
        // do something... 
       }]; 
+1

+1। मैं बस इसे पोस्ट करने वाला था। Ninja'd। :) – Metabble