From d82ae696974fffe3d455dda95259394e325498e6 Mon Sep 17 00:00:00 2001 From: Piotr Suwara Date: Sat, 4 May 2019 19:37:17 +0300 Subject: [PATCH] Fixed seperator insets and loading issue --- .../Code/TableCarouselView.swift | 3 +-- .../Code/ViewController.swift | 26 ++++++++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Demo/CircularCarousel Demo/Code/TableCarouselView.swift b/Demo/CircularCarousel Demo/Code/TableCarouselView.swift index b8c8759..519276c 100644 --- a/Demo/CircularCarousel Demo/Code/TableCarouselView.swift +++ b/Demo/CircularCarousel Demo/Code/TableCarouselView.swift @@ -54,8 +54,7 @@ final class TableCarouselView: UITableViewCell, tableView.tag = indexPath.row tableView.style(withDetail: .carousel) tableView.clipsToBounds = false - - tableView.reloadData() + tableView.separatorInset.left = 0 return tableView } diff --git a/Demo/CircularCarousel Demo/Code/ViewController.swift b/Demo/CircularCarousel Demo/Code/ViewController.swift index 84a7b0f..e8e2c15 100644 --- a/Demo/CircularCarousel Demo/Code/ViewController.swift +++ b/Demo/CircularCarousel Demo/Code/ViewController.swift @@ -56,6 +56,7 @@ final class ViewController: UIViewController, // Setup table view controls tableView.register(UINib(nibName: ViewConstants.NibNames.tableCarousel, bundle: nil), forCellReuseIdentifier: ViewConstants.CellIdentifiers.tableCarousel) tableView.register(UINib(nibName: ViewConstants.NibNames.buttons, bundle: nil), forCellReuseIdentifier: ViewConstants.CellIdentifiers.buttons) + tableView.separatorInset.left = 0 } // MARK: - @@ -72,17 +73,22 @@ final class ViewController: UIViewController, return cell case ViewConstants.RowIndex.tableCarousel: - let cell: TableCarouselView = tableView.dequeueReusableCell(withIdentifier: ViewConstants.CellIdentifiers.tableCarousel) as! TableCarouselView + if let tableCarouselView = self.tableCarouselView { + return tableCarouselView + } else { + let cell: TableCarouselView = tableView.dequeueReusableCell(withIdentifier: ViewConstants.CellIdentifiers.tableCarousel) as! TableCarouselView + + cell.delegate = self + + cell.carousel.panEnabled = false + cell.carousel.swipeEnabled = false + cell.carousel.reloadData() + + tableCarouselView = cell + + return cell + } - cell.delegate = self - - cell.carousel.panEnabled = false - cell.carousel.swipeEnabled = false - cell.carousel.reloadData() - - tableCarouselView = cell - - return cell case ViewConstants.RowIndex.buttonCarousel: let cell: ButtonCarouselView = tableView.dequeueReusableCell(withIdentifier: ViewConstants.CellIdentifiers.buttons) as! ButtonCarouselView