您的位置:首页 > 移动开发 > IOS开发

iOS 中设备接口集合 以及xcode常用设置(慢慢积累补充)

2013-12-18 10:41 330 查看
一、设备接口集合

1.调节设备屏幕亮度(真机有效)

[[UIScreen mainScreen] setBrightness:value]; (0=<value<=1)

2.调节设备音量(真机有效)

[[MPMusicPlayerController applicationMusicPlayer] setVolume:value]; (0=<value<=1)

3.拨号(真机有效)

3.1 直接通过UIApplication 的openURL方式拨号:

NSString *telURLString = [NSString stringWithFormat: @"tel:%@",numberString];
NSURL *phoneURL = [NSURL URLWithString:telURLString];
[[UIApplication sharedApplication] openURL:phoneURL];
使用这种方式拨号结束后不会自动返回原应用,而是停留在通讯录界面

3.2 使用webview 间接拨号:

NSString *telURLString = [NSString stringWithFormat: @"tel:%@",numberString];
NSURL *phoneURL = [NSURL URLWithString:telURLString];
if (!_phoneCallWebView) {
_phoneCallWebView = [[UIWebView alloc] initWithFrame:CGRectZero];
}
[_phoneCallWebView loadRequest:[NSURLRequest requestWithURL:phoneURL]];
使用这种方式拨号,中间会多出一个提示框,拨号结束后可返回原应用

二、xcode常用设置

1.设置应用语言类型

在程序的plist文件中加上以下配置

<key>CFBundleLocalizations</key>
<array>
<string>zh_CN</string>
<string>en</string>
</array>

2.当出现第三方组件不兼容你的编译设置时,可以设置Build Active Architecture Only 的release为Yes

3.当出现第三方组件中的一些类未预编译时,可以设置Other Linker Flags 为 -Objc -all_load

如果这样还不行可以人工进行预编译: [urClass class];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: