I have a UINavigationController
that can show data as UICollectionView
or in UITableView
. iOS 7 automatically adjust scroll view inset for the first UIScrollView
founded in the view hierarchy.
So, UICollectionView
is ok but I have to set contentEdgeInset
for the UITableView
. After this line
self.tableView.contentInset = UIEdgeInsetsMake(44.0f, 0.0f, 0.0f, 0.0f);
content in UITableView
are shown well, but the scroll indicator doesn't stop at the UINavigationBar
, but continue under it.
How can I resolve this and stop the scroll indicator at the begin of UINavigationBar
?
You can also set the scrollIndicatorInsets
as follows:
self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(44.0f, 0.0f, 0.0f, 0.0f);
By the way, on iOS 7, you should use [self.topLayoutGuide length]
instead of hard-coding 44.0f
pixels. From the iOS 7 Transition Guide:
The topLayoutGuide and bottomLayoutGuide properties indicate the location of the top or bottom bar edges in a view controller’s view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With