有没有办法在您的应用程序中设置/更新settings.bundle中的值.我很好地阅读从偏好到NSUserDefaults的值,但是想知道你是否可以在应用程序中设置值.
我有一个网络应用程序,我正在制作iPhone客户端,并考虑在settings.bundle中包含用户帐户详细信息.如果用户仅通过Apple Application Preferences屏幕更新值,那么这很好,但是如果用户在Web应用程序中更新了这些值,该怎么办呢.我想从网上下载值,然后从应用程序中"更新"settings.bundle中的值.
我猜这是不可能的,也许我需要创建自己的"应用程序内"设置屏幕?但是我想先跟你们一起检查......
我有一个UIScrollView,它有10个来自数组的图像.我需要使用按钮向左或向右滚动到下一个或上一个图像
button scrollview button
< [ ... ] >
Run Code Online (Sandbox Code Playgroud) 我在Android 2.2上使用RecognizerIntent API时遇到问题.当我使用此代码调用API时:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
startActivityForResult(intent, REQUEST_CODE_VOICE_SEARCH);
Run Code Online (Sandbox Code Playgroud)
看起来它应该工作,搜索弹出窗口在设备上和日志中说"未知问题":
01-17 14:25:30.433: ERROR/RecognitionActivity(9118): ACTION_RECOGNIZE_SPEECH intent called incorrectly. Maybe you called startActivity, but you should have called startActivityForResult (or otherwise included a pending intent).
01-17 14:25:30.433: INFO/RecognitionControllerImpl(9118): startRecognition(#Intent;action=android.speech.action.RECOGNIZE_SPEECH;launchFlags=0x800000;component=com.google.android.voicesearch/.IntentApiActivity;B.fullRecognitionResultsRequest=true;S.android.speech.extra.LANGUAGE_MODEL=free_form;end)
01-17 14:25:30.433: INFO/RecognitionControllerImpl(9118): State change: STARTING -> STARTING
01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118): required extra 'calling_package' missing in voice search intent
01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118): ERROR_CLIENT
01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118): ERROR_CLIENT
Run Code Online (Sandbox Code Playgroud)
看起来问题是缺少"calling_package"额外的; 在RecognizerIntent页面上,它声明这个额外的是:
用于语音识别器的意图用于语音搜索的额外密钥.通常不被开发人员使用.例如,系统搜索对话框使用它来设置一个呼叫包,以便通过语音搜索API进行识别.如果除系统进程之外的任何人设置此额外内容,则应由语音搜索实现覆盖它.
据我所知,我不需要覆盖这个额外的,所以为什么我得到这个错误?我该如何修复我的代码?
为什么抛出的异常getA()
没有被抓住?
#include<iostream>
using namespace std;
class Base{
protected:
int a;
public:
Base() { a=34; }
Base(int i){ a = i; }
virtual ~Base() { if(a<0) throw a; }
virtual int getA()
{
if(a < 0) { throw a;}
}
};
int main()
{
try
{
Base b(-25);
cout << endl << b.getA();
}
catch (int) {
cout << endl << "Illegal initialization";
}
}
Run Code Online (Sandbox Code Playgroud)
我理解你对堆栈展开的看法.
如果我改为Base
下面,我现在进行"非法初始化"调试打印.为什么我不再打电话了terminate()
?
Base() { a=34; }
Base(int i){ a …
Run Code Online (Sandbox Code Playgroud) 如何插入UINavigationController
内部UITabBarController
.
目前我UITabBarController
在应用程序委托中主要使用declatarion(所以tab是main)
self.window.rootViewController = self.tabBarController;
Run Code Online (Sandbox Code Playgroud)
在我希望插入的一个标签内UINavigationController
,并且无法获取它.
代码构造如下:
MainWindow.xib
使用UITabBarController
选项卡键入的对象UINavigationController
(指向NavigationHistory.xib
) - 屏幕截图:无效链接NavigationHistory.xib
仅包含UINavigationController
View.xib的视图History.xib
只有UITableView
元素 - 截图:无效链接现在UIViewController
不显示我的View1视图,我不知道它为什么会这样.也许你有任何线索?或者指向我进行此类配置的地方.
注意:请参阅预期输出与实际输出
#import<Foundation/Foundation.h>
int main()
{
system("clear");
NSDictionary *d1 = nil;
@autoreleasepool
{
d1 = [[NSDictionary alloc] initWithObjectsAndKeys: @"AAA", [NSNumber numberWithInt:10],
@"BBB", [NSNumber numberWithInt:20],
@"CCC", [NSNumber numberWithInt:30],
nil];
}
for(NSNumber* n1 in d1) //I expected fast enumeration for NSDictionary to be based on the
//ascending order of the key but that doesn't seem to be the case
{
printf("key = %p"
"\t [key intValue] = %i"
"\t value = %s\n", …
Run Code Online (Sandbox Code Playgroud) 我是Java新手.有人能帮助我吗?
Java中是否有任何方法可以自动转义下面正则表达式中的特殊字符?
在逃跑之前***(.*)
和逃跑之后\\*\\*\\*(.*)
我不想在这里逃避(.*).
我想从命令行中杀死所有的firefox进程.
MacPro:huangr$ ps -x | grep 'firefox'
4147 ttys000 0:00.00 (firefox-bin)
4177 ttys000 0:00.00 (firefox-bin)
4234 ttys000 0:00.00 (firefox-bin)
4273 ttys000 0:00.00 (firefox-bin)
4282 ttys000 0:00.00 (firefox-bin)
4285 ttys000 0:00.00 (firefox-bin)
4298 ttys000 0:00.00 (firefox-bin)
4301 ttys000 0:00.00 (firefox-bin)
4304 ttys000 0:00.00 (firefox-bin)
4311 ttys000 0:00.00 (firefox-bin)
4317 ttys000 0:00.00 (firefox-bin)
4320 ttys000 0:00.00 (firefox-bin)
4338 ttys000 0:00.00 (firefox-bin)
4342 ttys000 0:00.00 (firefox-bin)
4377 ttys000 0:03.85 /Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -foreground
4394 ttys000 0:05.54 /Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -foreground
4471 ttys000 0:06.08 /Applications/Firefox.app/Contents/MacOS/firefox-bin …
Run Code Online (Sandbox Code Playgroud) 我正在使用UILocalNotification,我在这个链接上阅读了有关它的苹果文档:
但我的问题是我可以安排多少通知?...因为这里写的是:
系统保持最快的64次通知(自动重新安排的通知计为单个通知)并丢弃其余的通知.
这条线意味着什么?...我可以安排超过64个通知吗?我不希望火64同时出现,我只希望安排超过64次通知...然后在火灾时间点火...
我遇到了许多人之前遇到过的问题,但随着新的iOS版本的出现和API的变化,它的解决方案会随着时间而变异.以前的解决方案都不适用于我目前的设置 - XCode 4.2.1,iPhone模拟器5.0或真正的iPhone 5.0,应用程序的目标是iOS5,使用ARC和Storyboard.
我有一个经典的Tabbed应用程序-ie UITabBarController,其中有4个选项卡...忽略2到第4个选项卡..第一个选项卡包含一个UINavigationController,其rootviewcontroller是一个UITableViewController.现在我将1个CustomUIViewController推入堆栈.
整个设置在Storyboard中进行了视觉设计,推送由segue完成.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
self.hidesBottomBarWhenPushed = YES;
}
Run Code Online (Sandbox Code Playgroud)
这有效地隐藏了tabbar,就像iPod应用程序在iPhone中一样.
但是当我从堆栈弹出CustomUIViewController时,TabBar不会回来.我正在把
self.hidesBottomBarWhenPushed = NO;
Run Code Online (Sandbox Code Playgroud)
到所有可能的和不可能的地方,但没有运气.
我如何将我的TabBar带回来?
iphone ×3
ios ×2
objective-c ×2
android ×1
c++ ×1
command-line ×1
escaping ×1
ios5 ×1
java ×1
layout ×1
macos ×1
nsdictionary ×1
regex ×1
segue ×1
uibutton ×1
uiscrollview ×1
uitabbar ×1
unix ×1