2012-07-19 104 views
0

我有一個自定義UIControl,它可以有兩個自定義狀態 - >customEnabled/customDisabled。在技​​術上,這種UIControl的狀態變化隱藏/顯示狀態集的定義視圖。到目前爲止工作很好。UITableView中的自定義UIControl

當在UITableView中使用時,我遇到了以下問題:重新使用已啓用控件的單元格,禁用了控件時,我會在短時間內看到已啓用然後已禁用的控件。

狀態設置發生在UITableViewControllercellForRowAtIndexPath方法中。國家二傳手顯示/隱藏視圖。

有沒有人有一個想法如何得到沒有「動畫」適當的外觀?

+0

東西的代碼一點點可以幫助我們來幫助你。 – 2012-07-19 13:36:09

回答

1

包裝你顯示/隱藏在下面的

[CATransaction begin]; 
[CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions]; 
// do show/hide 
[CATransaction commit]; 
+0

Thx!這樣可行。這是否意味着,隱藏的屬性更改是默認動畫? – toppless 2012-07-19 14:54:55

+0

是的,他們是。請將帖子標記爲答案,如果它解決了問題。 – 2012-07-19 19:50:16

0

我會建議類似

[UIView setAnimationsEnabled:NO]; 
[UIView animateWithDuration:0.0 animations:^{ 
    // Code with animations turned off 
} completion:^(BOOL finished){ 
    [UIView setAnimationsEnabled:YES]; 
}]; 
+0

不幸的是,這種方法不起作用。 – toppless 2012-07-19 15:02:15