I have a strange behavior in a table view with sections. When i scroll the table ALL sections headers stay on the position and the table view below scrolls. Only if I scroll/touch the headers both are scrolling synchronously. Any idea what is wrong here?
class TVController < UITableViewController
def viewDidLoad
super
@sections = [{:title=>"30.03", :bookings=>["Opening Balance"]},
{:title=>"31.03", :bookings=>["Thai", "Coffee"]},
{:title=>"02.04", :bookings=>["Pizza"]},
{:title=>"03.04", :bookings=>["Nido, View", "Coffee ", "Withdrawel ", "Coffee "]},
{:title=>"07.04", :bookings=>["Mautgebühren "]},
{:title=>"11.04", :bookings=>["Tipp Hofer Alpl ", "Meral ", "Menterschwaige", "Eis"]},
{:title=>"12.04", :bookings=>["Flaucher"]},
{:title=>"14.04", :bookings=>["Thai "]},
{:title=>"25.04", :bookings=>["ATM", "Samen Schmitz", "Edeka ", "Maelu ", "Clearence"]},
{:title=>"26.04", :bookings=>["Auerdult ", "Schneebesen"]},
{:title=>"28.04", :bookings=>["Thai"]},
{:title=>"30.04", :bookings=>["Bahnhof "]},
{:title=>"05.05", :bookings=>["Thai"]},
{:title=>"07.05", :bookings=>["Valleys "]},
{:title=>"10.05", :bookings=>["Café "]}]
@table = UITableView.alloc.initWithFrame(self.view.bounds, style:UITableViewStyleGrouped)
@table.dataSource = self
@table.delegate = self
self.view.addSubview @table
end
def tableView(tableView, cellForRowAtIndexPath: indexPath)
@reuseIdentifier ||= 'ACCOUNT_TABLE_CELL'
cell = tableView.dequeueReusableCellWithIdentifier(@reuseIdentifier) || begin
UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier:@reuseIdentifier)
end
cell.textLabel.text = self.booking(indexPath)
cell
end
def numberOfSectionsInTableView(tableView)
self.sections.length
end
def tableView(tableView, numberOfRowsInSection: section)
self.sections[section][:bookings].length
end
def tableView(tableView, titleForHeaderInSection: section)
self.sections[section][:title]
end
def booking(indexPath)
@sections[indexPath.section][:bookings][indexPath.row]
end
end