我在我的iPhone应用程序的导航栏中添加了分段控件.默认情况下,分段控件的颜色与导航栏的颜色相匹配.我想将分段控件的颜色与导航栏中的其他按钮(如后退导航按钮)相匹配.
任何人都可以告诉我一个RGB值(或系统颜色)与UIButtonBarItems的默认颜色相匹配,这些UIButtonBarItems已经添加到UIBavigationBar,风格为UIBarStyleDefault吗?
我在我的iPhone应用程序中使用SQLite数据库.在启动时,我想在一个单独的线程中执行一些数据库操作.(我这样做主要是为了减少启动时间.)
偶尔/随机,当从后台线程进行这些数据库调用时,应用程序将因以下错误而崩溃:
2009-04-13 17:36:09.932 Action Lists[1537:20b] *** Assertion failure in -[InboxRootViewController getInboxTasks], /Users/cperry/Dropbox/Projects/iPhone GTD/GTD/Classes/InboxRootViewController.m:74
2009-04-13 17:36:09.932 Action Lists[1537:3d0b] *** Assertion failure in +[Task deleteCompletedTasksInDatabase:completedMonthsAgo:], /Users/cperry/Dropbox/Projects/iPhone GTD/GTD/Classes/Data Classes/Task.m:957
2009-04-13 17:36:09.933 Action Lists[1537:20b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error: failed to prepare statement with message 'library routine called out of sequence'.'
2009-04-13 17:36:09.933 Action Lists[1537:3d0b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error: failed to prepare statement with message 'library routine called out of sequence'.'
Run Code Online (Sandbox Code Playgroud)
虽然我无法可靠地重现错误,但我确信这是因为在两个活动线程中都调用了SQLite函数.我 …
我正在尝试在我的iPhone应用程序中使用SQLite C API.我正在尝试查询SQLite数据库以查找在特定日期之后已完成的记录数.数据库将完成的日期保存为文本
YYYY-MM-dd格式.例如文本
2009-04-10可能会显示为完成日期.
当我从命令行查询数据库时,我的查询有效,但是当从应用程序运行时,它不会.这是我正在做的事情:
从命令行,我运行此查询:
sqlite> SELECT COUNT(*) FROM tasks WHERE completed > '2009-04-09'
...> go
1
Run Code Online (Sandbox Code Playgroud)
如您所见,有一条记录可以找到.
在我的应用程序中,我执行此代码(显然是用Objective-C编写的):
static sqlite3_stmt *count_tasks_statement = nil;
if(count_tasks_statement == nil) {
const char *sql = "SELECT COUNT(*) FROM tasks WHERE completed > '?'";
if (sqlite3_prepare_v2(database, sql, -1, &count_tasks_statement, NULL) != SQLITE_OK) {
NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database));
}
}
NSString *today = @"2009-04-09";
sqlite3_bind_text(count_tasks_statement, 1, [today UTF8String], -1, SQLITE_TRANSIENT);
// Get the row count …Run Code Online (Sandbox Code Playgroud)