내가 기본 취소하고 완료 버튼, 여기에이 ActionSheetPicker 3.0
@IBAction func showCompanyTypes(_ sender: Any) {
let cancelButton:UIButton = UIButton(type: .custom)
cancelButton.setTitle("Cancel", for: .normal)
cancelButton.setTitleColor(UIColor.black, for: .normal)
cancelButton.frame = CGRect(x: 0, y: 0, width: 55, height: 32)
let doneButton:UIButton = UIButton(type: .custom)
doneButton.setTitle("Done", for: .normal)
doneButton.setTitleColor(UIColor.black, for: .normal)
doneButton.frame = CGRect(x: 0, y: 0, width: 55, height: 32)
let acp = ActionSheetStringPicker(title: "Company Type", rows: ["Private Sector", "Government", "Semi Government", "Free Zone"], initialSelection: 0, doneBlock: {
picker, values, indexes in
print("values = \(values)")
print("indexes = \(indexes)")
print("picker = \(picker)")
return
}, cancel: { ActionMultipleStringCancelBlock in return }, origin: sender)
acp?.pickerTextAttributes = [NSFontAttributeName: UIFont.systemFont(ofSize: 15.0)]
acp?.setTextColor(UIColor.black)
acp?.pickerBackgroundColor = UIColor.white
acp?.toolbarBackgroundColor = UIColor.white
acp?.toolbarButtonsColor = UIColor.black
acp?.setCancelButton(UIBarButtonItem(customView: cancelButton))
acp?.setDoneButton(UIBarButtonItem(customView: doneButton))
acp?.show()
}
의 기본 취소 사용자 정의하는 샘플 코드 및 완료 도구 모음 버튼입니다 지역화 몇 가지 예를 들어 검색했다 기본 라이브러리로 변경하십시오. 그렇지 않으면 해당 옵션이 없습니다. –