IOS-Swift开发——自定义底部菜单
文章目录
自定义底部菜单:源代码
使用方法:
@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的列表显示:
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论