0
UITableView와 "A"라는 버튼이있는 UIViewController가 있습니다. 이 테이블에는 섹션과 행이 있습니다. 이제는 내 시나리오에서 "A"를 클릭했을 때 섹션을 강조하고 싶습니다. 전체 테이블 뷰를 다시로드하고 싶지 않기 때문에 viewForHeaderInSection에서이 작업을 수행하고 싶지 않습니다. 다음과 같이 내가 버튼 클릭의 순간에 노력하고 코드는전체 UITableView를 새로 고치지 않고 섹션의 배경색을 업데이트하십시오.
public func scrollToSection(sectionNumber:Int)
{
let indexPath = NSIndexPath(forRow: 0, inSection: sectionNumber)
let headerView = tableView.headerViewForSection(indexPath.section)
tableView.beginUpdates()
headerView?.contentView.backgroundColor = UIColor.cyanColor()
tableView.endUpdates()
tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: UITableViewScrollPosition.Middle, animated: true)
}
하지만 어떻게 든 버튼 클릭에 시안 색 표시되지 않습니다. 누구든지 적절한 솔루션을 신속하게 게시 할 수 있습니까?
감사합니다. 그게 내 문제를 해결했다. – neena