Skip to content

Commit 96effb7

Browse files
committed
VLCFavouriteListViewController: Fix the search bar constraints while scrolling
VLCFavouriteListViewController: Remove white spaces, debug
1 parent 093a4d2 commit 96effb7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/Network/Favorite/iOS/VLCFavoriteListViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class VLCFavoriteListViewController: UIViewController {
104104
searchBarConstraint = searchBar.topAnchor.constraint(equalTo: view.topAnchor, constant: -searchBarSize)
105105
view.addSubview(searchBar)
106106
NSLayoutConstraint.activate([
107-
searchBar.topAnchor.constraint(equalTo: view.topAnchor, constant: 5),
107+
searchBarConstraint!,
108108
searchBar.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 10),
109109
searchBar.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -10),
110110
searchBar.heightAnchor.constraint(equalToConstant: searchBarSize)
@@ -210,10 +210,10 @@ extension VLCFavoriteListViewController: UITableViewDelegate, UITableViewDataSou
210210
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
211211
let cell = tableView.dequeueReusableCell(withIdentifier: "LocalNetworkCell", for: indexPath) as! VLCNetworkListCell
212212
if let favorite = isSearching ? searchResults[indexPath.row] : favoriteService.favoriteOfServer(with: indexPath.section, at: indexPath.row) {
213-
cell.title = favorite.userVisibleName
214-
cell.isDirectory = true
215-
cell.thumbnailImage = UIImage(named: "folder")
216-
cell.folderTitleLabel.textColor = PresentationTheme.current.colors.cellTextColor
213+
cell.title = favorite.userVisibleName
214+
cell.isDirectory = true
215+
cell.thumbnailImage = UIImage(named: "folder")
216+
cell.folderTitleLabel.textColor = PresentationTheme.current.colors.cellTextColor
217217
}
218218
return cell
219219
}
@@ -280,7 +280,6 @@ extension VLCFavoriteListViewController: UISearchBarDelegate {
280280
searchResults = searchDataSource
281281
} else {
282282
searchResults = searchDataSource.filter { favorite in
283-
print(favorite.userVisibleName)
284283
return favorite.userVisibleName.range(of: searchText, options: .caseInsensitive) != nil
285284
}
286285
}
@@ -301,6 +300,7 @@ extension VLCFavoriteListViewController: UISearchBarDelegate {
301300
extension VLCFavoriteListViewController: UIScrollViewDelegate {
302301
func scrollViewDidScroll(_ scrollView: UIScrollView) {
303302
searchBarConstraint?.constant = -min(scrollView.contentOffset.y, searchBarSize) - searchBarSize
303+
view.layoutIfNeeded()
304304
if scrollView.contentOffset.y < -searchBarSize && scrollView.contentInset.top != searchBarSize {
305305
tableView.contentInset.top = searchBarSize
306306
}

0 commit comments

Comments
 (0)