说明:依系统设定的源码自动切换适合的显示字串
操作:
在Interface Builder中设计时的介面
若系统设定为英文则显示英文介面
若系统设定为繁体中文则显示为中文介面
如何建立自定的语系档:
1,在Resources分类下新增档案 [右键/Add/New File...]
2,在范本的分类选择Other后再选择Strings File
3。将存档档名设定为Localizable.strings
4。在Localizable.strings档案上按右键并选择Get Info
5,选择左下方的Make File Localizable
6。将分页标签切换至General
7。选择左下方的Add Localization
8。input;新的语系名称zh_TW后按Add
9,您会看到目前您设定了English及zh_TW两种语系
10。在档案清单中您将看到Localizable Strings (English) 及 Localizable String (zh_TW)
11开启后编辑源码字串就可以啰,范例如下:
Localizable.strings (English)
/*
Localizable.strings
MultiLanguageDemo
Created by babyfish0226 on 2009/3/6.
Copyright 2009 __MyCompanyName__. All rights reserved.
*/
"DemoTitle"="This is English Version";
"String1"="Apple";
"String2"="BAnana";
"String3"="Orange";
"String4"="Watermelon";
"String5"="Strawberry";
Localizable.strings (zh_TW)
/*
Localizable.strings
MultiLanguageDemo
Created by babyfish0226 on 2009/3/6.
Copyright 2009 __MyCompanyName__. All rights reserved.
*/
"DemoTitle"="這是繁體中文的版本";
"String1"="苹果";
"String2"="香蕉";
"String3"="橘子";
"String4"="西瓜";
"String5"="草莓";
代码:
MultiLanguageDemoViewController.h
//
// MultiLanguageDemoViewController.h
// MultiLanguageDemo
//
// Created by babyfish0226 on 2009/3/6.
// Copyright __MyCompanyName__ 2009. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MultiLanguageDemoViewController : UIViewController {
IBOutlet UILabel *lbldemotitle;
IBOutlet UILabel *lblstr1;
IBOutlet UILabel *lblstr2;
IBOutlet UILabel *lblstr3;
IBOutlet UILabel *lblstr4;
IBOutlet UILabel *lblstr5;
}
@property (nonatomic,retain) UILabel *lbldemotitle;
@property (nonatomic,retain) UILabel *lblstr1;
@property (nonatomic,retain) UILabel *lblstr2;
@property (nonatomic,retain) UILabel *lblstr3;
@property (nonatomic,retain) UILabel *lblstr4;
@property (nonatomic,retain) UILabel *lblstr5;
@end
MultiLanguageDemoViewController.m
#import "MultiLanguageDemoViewController.h"
@implementation MultiLanguageDemoViewController
@synthesize lbldemotitle,lblstr1,lblstr2,lblstr3,lblstr4,lblstr5;
- (void)viewDidLoad {
[super viewDidLoad];
//系统设定取得适合的多国语言字串
lbldemotitle.text=NSLocalizedString(@"DemoTitle",nil);
lblstr1.text= NSLocalizedString(@"String1",nil);
lblstr2.text=NSLocalizedString(@"String2",nil);
lblstr3.text=NSLocalizedString(@"String3",nil);
lblstr4.text=NSLocalizedString(@"String4",nil);
lblstr5.text=NSLocalizedString(@"String5",nil);
}
分享到:
相关推荐
iPhone App Design For Entrepreneurs,Find Success on the App Store without Coding,2019年新书,介绍iPhone App开发
目前市面上不乏iPhone App开发的书籍,但要做出成功的产品,需要的绝不仅仅是开发优秀的软件。本书将向你展示完整的开发过程,从下载工具,开发应用,进行测试,通过苹果的审核,到推销和维护你的产品。本书适合...
iphone_app发布到appstore步骤.详细描述了将iphone_app发布到appstore步骤,有截图,是比较详细的文档,希望能给需要的人提供帮助
Anyone with programming experience can learn how to write an iPhone app. But if you want to build a great app, there’s a lot more to it than simple coding: you also need to know how design and ...
IPhone 6/6s IOS 经典app列表,好用的经典,大家不用找来找去啦!
iphone 上的 AppStore
this is sample code for developing iPhone App.
NULL 博文链接:https://bengan.iteye.com/blog/1431683
苹果ios iphone app programming guide
一个最简单的ios app源代码,希望对刚入门的兄弟有帮助
Foundation iPhone App Development
苹果iPhone APP开发教程 iOS教程.zip 1.如何注册成为苹果开发者 10.通用应用程序(非手机app) 12.相机管理 13.定位操作 2.下载IDE 3.Xcode 4.Objective-C 5.创建第一款iPhone应用程序 6.操作和输出口 7.委托...
Elven iPhone App Ui kit
iPhone App Programming Guide
iphone web app 开发. rt rt
iPhone有自己的特点和气质,因此 iPhone App(应用软件)不同于其他键盘手机甚至Android这种触屏手机。 iphone APP 特点...
iPhone app发布到appstore的步骤 1.要在苹果网站上注册APP ID,以及购买iPhone Develop Program(iDP) 开发者授权,99美元。 2.创建发布程序的证书。 步骤如下: 如果已经购买了开发账号IDP, 登录进去后会看到如下...
ios学习资料 iPhone+App开发实战手册,又相关基础可以看看写的很全
iphone app企业官网模板是一款黑色大气的iphone app企业官网模板下载。.rar