Open willnix86 opened 5 years ago
I have the following code set up...
self.addSubview(button) button.backgroundColor = backgroundColor button.setTitleColor(UIColor.black, for: .normal) button.addTarget(self, action: #selector(toggleDropdown), for: .touchUpInside) button.snp.makeConstraints { (make) -> Void in make.left.right.equalTo(self) make.height.equalTo(45) } self.addSubview(dropdown) dropdown.anchorView = button dropdown.dataSource = self.options dropdown.direction = .bottom dropdown.bottomOffset = CGPoint(x: 0, y:(dropdown.anchorView?.plainView.bounds.height)!) dropdown.selectionAction = { [unowned self] (index: Int, item: String) in self.button.setTitle(item, for: .normal) print("Selected item: \(item)") }
But the dropdown still covers the button (it's anchorview). What am I missing, or is something broken?
try to use CGPoint(x: 0, y: button.frame.height)
I have the following code set up...
But the dropdown still covers the button (it's anchorview). What am I missing, or is something broken?