Domanda

I had a UINavigationBar translucent (iOS7) with a UITableView. When I scroll, I see the tableView behind my Navigationbar, but the cells are too small and are reused too soon.

How can I configure my UITableView to prevent this effect ?

Thank's for your advices !

È stato utile?

Soluzione 2

The solution is to :

  • set a negative frame to the TableView : tableView.frame = CGRectMake(0, -64, 320, 568+64);
  • add a contentInset : tableView.contentInset = UIEdgeInsetsMake(64, 0, 0, 0);
  • and a scrollIndicatorInsets : tableView.scrollIndicatorInsets = UIEdgeInsetsMake(64, 0, 0, 0);

I don't like this trick, but it's the only reasonable I find...

Altri suggerimenti

What do you mean by too soon? You can prevent the tableView cell reusing completely simply by avoiding the dequeueReusableCellWithIdentifier on the tableView and just creating a new cell every time, but you should be really careful with that as it will use much more memory.

The other, preferable option is to work out your tableView logic so that the cell do not disappear, but to help there, you need to post some code.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top