自定义底部菜单:
使用方法:
@objc fileprivate func onAlertAction(sender: UIButton) { let items = [AlertSheetItem(title: "退出", style: .special), AlertSheetItem(title: "其他", style: .light)] let sheet = AlertSheet.actionSheet(title: "请选择", cancelItemTitle: "取消", otherItemTitles: items) sheet.didClickedItemAtIndexHandler = { (rowIndex) in if rowIndex == 0 { NSLog("didClicked Item at \(rowIndex)") } } sheet.didClickedCancelHandler = { NSLog("didClicked Cancel") } sheet.show()}
运行效果:
支持多个item的列表显示: