var myActionSheet:UIActionSheet = UIActionSheet()
var title : String? = "Select Source"
myActionSheet.title = title
myActionSheet.delegate = self
myActionSheet.addButtonWithTitle("camera")
myActionSheet.addButtonWithTitle("Library")
myActionSheet.addButtonWithTitle("Cancel")
myActionSheet.cancelButtonIndex = 2
myActionSheet.showInView(self.view)
func actionSheet(myActionSheet: UIActionSheet!, clickedButtonAtIndex buttonIndex: Int){
println("the index is %d", buttonIndex)
}
本文介绍了一个使用 Swift 实现的 UIActionSheet 示例。该示例展示了如何创建并显示一个带有多个按钮的 UIActionSheet,包括 'camera'、'Library' 和 'Cancel' 按钮,并设置点击事件处理。
356

被折叠的 条评论
为什么被折叠?



