let alert =UIAlertController(title:"警告",message:"是否要删除当前设备?",preferredStyle: .Alert);
let btnOk = UIAlertAction(title:"确定",style: .Default) { (UIAlertAction) ->Void in
print("确定操作!");
}
let btnCancel = UIAlertAction(title:取消",style: .Cancel) { (UIAlertAction) ->Void in
print("取消操作!");
}
alert.addAction(btnOk);
alert.addAction(btnCancel);
self.presentViewController(alert,animated:true,completion: nil);
效果图