语音适配Xcode

屏幕快照 2016-10-25 下午7.38.27.png

![

屏幕快照 2016-10-25 下午7.39.54.png

屏幕快照 2016-10-25 下午7.41.04.png

屏幕快照 2016-10-25 下午7.40.51.png
](http://upload-images.jianshu.io/upload_images/2683945-1d67656a22fd70d9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

//
//  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" = "取消";


![屏幕快照 2016-10-25 下午7.40.10.png](http://upload-images.jianshu.io/upload_images/2683945-0b580295de119f59.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容