Skip to content

Commit

Permalink
Adjusting scroll view bottom inset (#1)
Browse files Browse the repository at this point in the history
* Adjusting scroll view bottom inset

This is needed for devices with physical home button

* added comment to the magic number 16
  • Loading branch information
pnuts2 authored Aug 25, 2021
1 parent 9ca9f8f commit 803afd5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Sources/TGCardViewController/cards/TGTableCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,17 @@ open class TGTableCard: TGCard {
return
}

embeddedScrollView.contentInset.bottom = scrollCardView.safeAreaInsets.bottom
embeddedScrollView.verticalScrollIndicatorInsets.bottom = scrollCardView.safeAreaInsets.bottom
if scrollCardView.safeAreaInsets.bottom == 0 {
// For devices with physical Home button, we need to add some extra padding
// from the bottom, otherwise, the last row of the table view will be
// partially hidden below the screen.
embeddedScrollView.contentInset.bottom = scrollCardView.safeAreaInsets.bottom + 16
embeddedScrollView.verticalScrollIndicatorInsets.bottom = scrollCardView.safeAreaInsets.bottom + 16
} else {
embeddedScrollView.contentInset.bottom = scrollCardView.safeAreaInsets.bottom
embeddedScrollView.verticalScrollIndicatorInsets.bottom = scrollCardView.safeAreaInsets.bottom
}


autoDeselect(scrollCardView)
}
Expand Down

0 comments on commit 803afd5

Please sign in to comment.