在tableView上添加索引后索引可能會遮蓋 搜索條或headview 解決辦法:
iOS tableView 添加索引后 索引遮蓋 headview 解決辦法
ios tableView 添加索引后 索引遮蓋 Search Bar 解決辦法
在TableView上方添加一個(gè)Search Bar,這里有一點(diǎn)需要注意孵延,必須先把TableView拖下來舞骆,留下空間放Search Bar,不要在Table View占滿屏幕的情況下把Search Bar拖到Table View頂部壹若。區(qū)別在于,使用后面的方法缤骨,Search Bar是作為Table View的Header部分添加的,而前面的方法左冬,Search Bar是獨(dú)立的葵陵。在添加索引功能時(shí),如果作為Table View的Header添加蘸泻,右側(cè)的索引會遮住Search Bar的右邊部分畅卓。
想要避免遮蓋 可以 在reloadData 前 加入:
contactsTable.sectionIndexBackgroundColor=[UIColorclearColor];
contactsTable.sectionIndexTrackingBackgroundColor = [UIColorclearColor];
// contactsTable.sectionIndexColor = [UIColor blackColor];
[contactsTablereloadData];
這樣就能避免遮蓋了。