[英]Custom UITableView section header alpha 0
我已經為UITableView
實現了自定義節標題。 除了在tableview中插入一個部分外,它都可以正常工作。 然后它完全消失了,如果我調試的話,我可以看到自定義節頭的alpha
屬性為0
,我當然沒有設置。
當自定義標題消失時,這就是我正在做的事情:
[self.settingsTableView beginUpdates];
[self.settingsTableView insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
[self.settingsTableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
[self.settingsTableView endUpdates];
重新加載不應在beginUpdates
和endUpdates
內部endUpdates
使用自定義標頭並返回本地ivar實例時,我遇到了完全相同的問題。
問題在於,UITableView希望您在以下方面返回不同的視圖:
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
我認為它認為它有2個視圖,會將舊的alpha設置為1,將alpha設置為0 ...但是在我的情況下,“新的”仍然使用錯誤的alpha。
解決方案是僅在該視圖中為節委托方法實例化一個新視圖。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.