1

自定义底部菜单:源代码

使用方法:

@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的列表显示:

图片描述


RichardXG
337 声望19 粉丝