문제

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 !

도움이 되었습니까?

해결책 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...

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top