[英]Custom UIControl within UITableView
我有一個自定義UIControl
,可以有兩個自定義狀態-> customEnabled
/ customDisabled
。 從技術上講,此UIControl
狀態更改導致隱藏/顯示狀態集的定義視圖。 到目前為止工作正常。
在UITableView
使用時,我遇到以下問題:在對禁用了控件的單元格重復使用已啟用控件的單元格時,我會在很短的時間內看到已啟用然后禁用的控件。
狀態設置發生在UITableViewController
的cellForRowAtIndexPath
方法中。 狀態的設置器顯示/隱藏視圖。
有誰知道如何在沒有“動畫”的情況下獲得合適的外觀?
將您的顯示/隱藏在下面
[CATransaction begin];
[CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions];
// do show/hide
[CATransaction commit];
我打算提出類似的建議
[UIView setAnimationsEnabled:NO];
[UIView animateWithDuration:0.0 animations:^{
// Code with animations turned off
} completion:^(BOOL finished){
[UIView setAnimationsEnabled:YES];
}];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.