UIActionSheet的常用方法

enum UIActionSheetStyle : Int {
    
    case Automatic // take appearance from toolbar style otherwise uses 'default'
    case Default //默认风格:灰色背景上显示白色文字  
    case BlackTranslucent ////透明黑色背景,白色文字
    case BlackOpaque // //纯黑背景,白色文字  
}
//初始化,标题,代理,取消按钮,销毁按钮
init(title: String?, delegate: UIActionSheetDelegate?, cancelButtonTitle: String?, destructiveButtonTitle: String?) unowned(unsafe) var delegate: UIActionSheetDelegate?

  var title: String

//风格

    var actionSheetStyle: UIActionSheetStyle 

//添加按钮

func addButtonWithTitle(title: String) -> Int

// 返回 buttonIndex位置的按钮标题

func buttonTitleAtIndex(buttonIndex: Int) -> String

//获取有多个按钮

var numberOfButtons: Int { get }

//取消按钮的下标

 var cancelButtonIndex: Int 

//销毁按钮的下标

  var destructiveButtonIndex: Int 

//第一个其他按钮的下标

 var firstOtherButtonIndex: Int { get } 

  var visible: Bool { get }

 

 

//showInview可能会导致弹出菜单被toolbar挡住,最下面的按钮不一定能接受的touch事件,showFromToolbar 是在toolbar上方弹出,就不会有这个问题 
//在toolbar上面显示
func showFromToolbar(view: UIToolbar!) func showFromTabBar(view: UITabBar!) @availability(iOS, introduced=3.2) func showFromBarButtonItem(item: UIBarButtonItem!, animated: Bool) @availability(iOS, introduced=3.2) func showFromRect(rect: CGRect, inView view: UIView!, animated: Bool) func showInView(view: UIView!)
原文地址:https://www.cnblogs.com/qzp2014/p/4273968.html