I have Tablview which contains number of sections.
First Section - it's contain search textbox
second section - its's contain UIView
other sections - this section which i want to reload at the time of searching.
UPDATE
I am set countdic and tableview like below :-
1. set countdic
self.countDic.updateValue(1, forKey: "0")// this is for First section
self.countDic.updateValue(0, forKey: "1")//this is for second section
for i in 0..<arra1.count {
self.countDic.updateValue(array.count, forKey: "\(i + 2)")//[index : arraylist.count]
}
2. Here is my tableview setup
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return countDic["\(section)"]!
}
func numberOfSections(in tableView: UITableView) -> Int {
return countDic.count
}
3. Here i am reload tableview
This is from shouldChangeCharactersIn of UITextfield
let indexSet = IndexSet(integersIn: 2..<self.TblView.numberOfSections)
self.TblView.reloadSections(indexSet, with: .bottom)
but it's crash the app with Error :
** reason: 'attempt to insert section 3 but there are only 3 sections after the update' **
Can anyone suggest how to done ?