corin8823 / Popover

Popover is a balloon library like Facebook app. It is written in pure swift.
MIT License
2.09k stars 325 forks source link

Popover with tableView didn't scroll #113

Open fcsd opened 5 years ago

fcsd commented 5 years ago

I use this library. TableView in popover doesn't scroll.

let minPopoverHeight = CGFloat(264)

 lazy var popoverTableView: UITableView = {
        let tableView = UITableView()
        tableView.delegate = self
        tableView.dataSource = self
        tableView.tableFooterView = UIView()
        tableView.tag = SearchableTableViewTag.search.rawValue
        return tableView
    }()

    override func viewWillLayoutSubviews() {
        popoverTableView.frame = CGRect(x: 0, y: tableContainer.bounds.origin.y, width: view.bounds.size.width, height: minPopoverHeight)
    }

func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
        let popoverOptions = [
            .type(.down),
            .animationIn(0.3),
            .showBlackOverlay(false),
            .arrowSize(.zero),
            .color(.white),
            .dismissOnBlackOverlayTap(true),
        ] as [PopoverOption]

        searchPopover = Popover(options: popoverOptions, showHandler: nil, dismissHandler: {
            self.searchController.isActive = false
        })

        searchPopover?.show(popoverTableView, fromView: searchBar)
        return true
    }

That's way I use Popover.

Harsh061 commented 5 years ago

Hi @fcsd You can try setting tableView.isScrollEnabled = true programatically. It worked for me. Thanks.