https://github.com/AssistoLab/DropDown




        let lblDropDown : UILabel = {

            let ret = UILabel()

            ret.text = "drop down"

            ret.textColor = UIColor(hexColor: "9F9F9F")

            ret.lineBreakMode = .byClipping

            ret.sizeToFit()

            ret.isUserInteractionEnabled = true

            let tap = UITapGestureRecognizer(target: self, action: #selector(objDropDown))

            ret.addGestureRecognizer(tap)

            return ret

        }()

        

        self.bottomGroup.addSubview(lblDropDown)

        lblDropDown.snp.makeConstraints {

            $0.width.equalTo(40)

            $0.height.equalTo(40)

            $0.left.equalTo(lblSortBy.snp.right).offset(20)

        }



    @objc func objDropDown() {

        

        let dropDown = DropDown()

        // The view to which the drop down will appear on

        dropDown.anchorView = view // UIView or UIBarButtonItem

        

        // The list of items to display. Can be changed dynamically

        dropDown.dataSource = ["Car", "Motorcycle", "Truck"]

        

        // Action triggered on selection

        dropDown.selectionAction = { [unowned self] (index: Int, item: String) in

            print("Selected item: \(item) at index: \(index)")

        }

        

        dropDown.show()

    }

'{BE} Python 3.1x' 카테고리의 다른 글

plist 읽기  (0) 2020.07.01
nodepointer  (1) 2020.07.01
UITabBar 크기 조정  (0) 2020.06.30
Making mater-detail app to hadle imageView  (0) 2020.06.23
swift4 날짜 date 형식 formatting  (2) 2020.06.23

+ Recent posts