diff --git a/ios/ColumnWidths.swift b/ios/ColumnWidths.swift index 92e3d475..a3006e81 100644 --- a/ios/ColumnWidths.swift +++ b/ios/ColumnWidths.swift @@ -27,6 +27,16 @@ class ColumnWidths { resetColumnWidths(widths: widths) calculateDefaultColWidth(dataRows: dataRows, defaultWidth: defaultWidth, columnCount: columnCount, frame: frame) } + cleanUpValues() + } + + fileprivate func cleanUpValues() { + columnWidths = columnWidths.map{ (element) -> Double in + if element < DataCellView.minWidth { + return DataCellView.minWidth + } + return element + } } fileprivate func loadFromStorage(_ columnCount: Int) -> Bool { diff --git a/ios/ContainerView.swift b/ios/ContainerView.swift index d85991de..412c2413 100644 --- a/ios/ContainerView.swift +++ b/ios/ContainerView.swift @@ -213,10 +213,13 @@ class ContainerView: UIView { tableViewFactory.create() firstColumnTable = tableViewFactory.firstColumnTableView multiColumnTable = tableViewFactory.multiColumnTableView - + firstColumnTable?.resizeCells() + multiColumnTable?.resizeCells() + self.testTruncation() + DispatchQueue.main.async { self.firstColumnTable?.dataCollectionView?.signalVisibleRows() - self.testTruncation() + self.horizontalScrollView?.setContentOffset(CGPoint(x: 0, y: 0), animated: false) } } else { guard let firstColumnTable = self.firstColumnTable else { return } diff --git a/ios/DataCellView.swift b/ios/DataCellView.swift index b2bd8949..afd4d98b 100644 --- a/ios/DataCellView.swift +++ b/ios/DataCellView.swift @@ -261,7 +261,7 @@ class DataCellView: UICollectionViewCell, ExpandedCellProtocol { func updateSize(_ translation: CGPoint, forColumn index: Int) -> Bool { let view = contentView.subviews[index] let newWidth = view.frame.width + translation.x - if newWidth < DataCellView.minWidth { + if newWidth < DataCellView.minWidth && translation.x < 0 { return false } diff --git a/ios/TableView.swift b/ios/TableView.swift index ce1d310a..9a519f55 100644 --- a/ios/TableView.swift +++ b/ios/TableView.swift @@ -19,7 +19,7 @@ class TableView: UIView { var dymaniceLeadingAnchor = NSLayoutConstraint() var columnWidths: ColumnWidths? var grabbers = [() -> MultiColumnResizer?]() - + var dataRange: CountableRange = 0..<1 func grow(by delta: Double) { dynamicWidth.constant = self.frame.width + delta } @@ -33,7 +33,7 @@ class TableView: UIView { guard let columnWidths = columnWidths else { return } guard let dataCollectionView = dataCollectionView else { return } - let width = columnWidths.getTotalWidth(range: dataCollectionView.dataRange) + let width = columnWidths.getTotalWidth(range: dataRange) setWidth(width) if let headerView = headerView { @@ -58,7 +58,6 @@ class TableView: UIView { if let horizontalScrollView = horizontalScrolLView { let totalWidth = columnWidths.getTotalWidth() horizontalScrollView.contentSize = CGSize(width: totalWidth, height: 0) - horizontalScrollView.contentOffset.x = 0 } } @@ -81,11 +80,8 @@ class TableView: UIView { } if let lastGrabber = lastGrabber { - let width = columnWidths.getTotalWidth(range: 1..