封装了一个函数,用于弹框
/**
弹框
- parameter title: 标题
- parameter msg: 消息
- parameter btns: 弹框项
*/
func show(title:String,msg:String,btns:[String]?) {
let alert = UIAlertController(title: title,message: msg,preferredStyle: .Alert);
for(var i=0;i<btns?.count;i++) {
let btn = UIAlertAction(title: btns![i],style: .Default) { (UIAlertAction) -> Void in
print(UIAlertAction.title); // 打印选中内容
}
alert.addAction(btn);
}
let btn = UIAlertAction(title: "取消",style:.Destructive) { (UIAlertAction) -> Void in
var choose = -1;
}
alert.addAction(btn);
self.presentViewController(alert,animated: true,completion: nil);
}
let serialBar:[String] = ["类 型","串口号","波特率","数据位","停止位","校验位","","类 型","校验位"];
let serialBarData:[Int:[String]] = [0:["Rs232"],
1:["1","2","3","4"],
2:["9600","19200","38400","115200"],
3:["8","9"],
4:["1","1.5","2"],
5:["奇校验","偶校验",27)">无校验"],
6:[""],
7:["Rs485"],
8:["1",
9:["9600",
10:["8",
11:["2","1"],
12:[" ];