var sheet: UIActionSheet = UIActionSheet()
sheet.title = "Report this member?"
sheet.delegate = self
sheet.tag = 1
sheet.addButtonWithTitle("Cancel")
sheet.addButtonWithTitle("Report")
sheet.cancelButtonIndex = 0
sheet.showInView(self.view)
我想"报告"变成红色,取消变成灰色。
有没有具体的方法来做到这一点?
答案 0 :(得分:0)
您可以投放此广告,创建自定义按钮,将其添加为子视图
var sheet: UIActionSheet = UIActionSheet()
sheet.title = "Report this member?"
var btn:UIButton = UIButton()
btn.setTitle("Cancel", forState: UIControlState.Normal)
btn.setTitleColor(UIColor.whiteColor(), forState: UIControlState.Normal)
btn.backgroundColor = UIColor.grayColor()
btn.addTarget(self, action: "pressCancel", forControlEvents: UIControlEvents.TouchDown)
sheet.addSubview(btn)
var btn1:UIButton = UIButton()
btn1.setTitle("Report", forState: UIControlState.Normal)
btn1.setTitleColor(UIColor.whiteColor(), forState: UIControlState.Normal)
btn1.backgroundColor = UIColor.redColor()
btn1.addTarget(self, action: "pressReport", forControlEvents: UIControlEvents.TouchDown)
sheet.addSubview(btn1)