मैं UIButton को एनिमेट करने की कोशिश कर रहा हूं। लेकिन इसके एनीमेशन के दौरान, UIButton के साथ कोई बातचीत नहीं है। अपेक्षित व्यवहार बटन चलने के दौरान बटन पर क्लिक करने में सक्षम होना है। यहाँ UIButton के कोड स्निपेट और एनीमेशन है:UIButton एनीमेशन के दौरान बातचीत नहीं कर रहा है
UIImage *cloudImage = [UIImage imageNamed:@"sprite.png"];
UIButton moveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[moveBtn setFrame:CGRectMake(0.0, 80.0, cloudImage.size.width, cloudImage.size.height)];
[moveBtn setImage:cloudImage forState:UIControlStateNormal];
[moveBtn addTarget:self action:@selector(hit:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:moveBtn];
CGPoint newLeftCenter = CGPointMake(300.0f + moveBtn.frame.size.width/2.0f, moveBtn.center.y);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:5.0f];
[UIView setAnimationRepeatCount:HUGE_VALF];
moveBtn.center = newLeftCenter;
[UIView commitAnimations];
hit
चयनकर्ता सिर्फ अगर बटन यह करने के लिए नहीं प्रतिक्रिया देने या दिखाने के लिए एक NSLog प्रदर्शित करता है। किसी भी सहायता की सराहना की जाएगी।
मूल रूप से मेरी एनीमेशन बाएं से दाएं से जा रही है, मैं एनीमेशन पूर्ण होने तक प्रतीक्षा नहीं कर सकता। यह पहले स्थान पर एक बटन रखने के उद्देश्य को हरा देगा, क्योंकि इसके पास इसके आंदोलन के दौरान इसे छूने की क्षमता है। – Frank
कृपया मेरे संपादन देखें। – Moshe
आह शांत THX, मैं एक touchBegan जोड़ा गया है और रेक्ट कि छुआ जा रहा है का पता चला, इस, मेरे लिए काम हालांकि यह शांत हो गया होता है, तो बटन एनीमेशन स्लाइड :( – Frank