2010-01-04 3 views
6

वर्तमान में मैं इस कोड को ठीककोको setAnimationDidStopSelector

[UIView setAnimationDidStopSelector:@selector(animationDone:finished:context:)]; 

- (void)animationDone:(NSString *)animationID finished:(BOOL)finished context:(void *)context { 
// do stuff here 
} 

animationID का मूल्य लॉगिंग काम करता है मुझे एक अशक्त देता है।

मैं @ चयनकर्ता को मूल्य कैसे पास कर सकता हूं?

मैं

[UIView setAnimationDidStopSelector:@selector(animationDone:@"animation1"finished:context:)]; 

जो मुझे एक त्रुटि देता है की कोशिश की।

धन्यवाद, टी

उत्तर

16

स्ट्रिंग चयनकर्ता के लिए पारित किया है जिसे आप इस विधि कॉल में उपयोग करते हैं:

[UIView beginAnimations:@"your_animation_name_here" context:NULL]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)]; 
// whatever changes here 
[UIView commitAnimations]; 

बाद में, आप यह कर सकते हैं:

- (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context 
{ 
    if ([animationID isEqualToString:@"your_animation_name_here"]) 
    { 
     // something done after the animation 
    } 
} 
+1

इस: '[UIView setAnimationDidStopSelector: @selector (एनीमेशन पूर्ण: समाप्त: संदर्भ :)];' यह होना चाहिए: '[UIView setAnimationDidStopSelector: @selector (एनीमेशन समाप्त: समाप्त: contex टी :)]; ' –

+0

टिप्पणी के लिए धन्यवाद! सही किया। –