好吧,我知道有很多這樣的問題,但出於某種原因,我無法弄清楚爲什麼這個回調選擇器不會被調用?爲什麼這個動畫選擇器不會被調用?
以下是我添加到新的基於視圖的模板的兩種方法。 我將一個按鈕連接到IBAction,並將一個UIView鏈接到redRect插座。
動畫效果很好,但由於某種原因,我找不到,回調不會被調用。
- (IBAction)toggleView:(id)sender {
float target;
if (redRect.alpha == 0.0) target = 1.0;
else target = 0.0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationDidStopSelector:@selector(finished)];
redRect.alpha = target;
[UIView commitAnimations];
}
- (void)finished {
NSLog(@"Why won't this get called?");
}
請告訴我我在做什麼錯在這裏 - 這是如此簡單,但我只是無法弄清楚。
OH我的上帝我是那麼愚蠢 - 隨時downvote我:) –
我剛剛編碼了5個小時直,這可能是爲什麼... –
我們都去過那裏。如果Apple沒有委託人設置目標,那麼蘋果會很高興,但是哦(不利的一點是這是性能問題)。 – David