语音适配Xcode
2016-10-25 本文已影响0人
123467




//
// ViewController.swift
// 国际化Demo
//
// Created by 向银泉on 16/10/25.
// Copyright © 2016年 向银泉. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
//根据系统的语言匹配对应的提示框
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
//创建弹出框
let alertVC = UIAlertController(title: NSLocalizedString("TITLE", comment: ""), message: NSLocalizedString("MESSAGE", comment: ""), preferredStyle: .Alert)
//确定按钮
let conformAction = UIAlertAction(title: NSLocalizedString("CONFORM", comment: ""), style: .Default, handler: nil)
//取消按钮
let cancelAction = UIAlertAction(title: NSLocalizedString("CANCEL", comment: ""), style: .Cancel, handler: nil)
alertVC.addAction(conformAction)
alertVC.addAction(cancelAction)
self.presentViewController(alertVC, animated: true, completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
"TITLE" = "title";
"MESSAGE" = "message";
"CONFORM" = "conform";
"CANCEL" = "cancel";
"TITLE" = "标题";
"MESSAGE" = "信息";
"CONFORM" = "确定";
"CANCEL" = "取消";
