小编Viv*_*k T的帖子

选择表行的查询是什么,匹配Sqlite中的两个列约束

我正在尝试开发一个可以与数据库一起使用的登录程序.我使用了一个表emplopyee,列"Userid","Passwd"和"Name"(这三个都是'VARCHAR'类型).在我的程序中,我添加了两个文本字段"username"和"password".我得到了"用户名"和"密码"值,并将它们存储在两个全局对象中(类型为"NSString").
现在我想选择与给定的"Userid"和"Passwd"匹配的"Name".我出于上述原因使用的编码部分在这里:

sqlite3 *dB;
sqlite3_stmt *compiledStatement;
if(sqlite3_open([databasePath UTF8String], &dB)==SQLITE_OK){
    const char *sql="Select Name from employee Where Userid=? , Passwd=?";

           if(sqlite3_prepare_v2(dB, sql, -1, &compiledStatement, NULL)!=SQLITE_OK)
    NSAssert1(0,@"Error while reading Employee Name -->%s',sqlite3_errmsg(dB));
}
sqlite3_bind_text(compiledStatement,1,[txt UTF8String],-1,SQLITE_TRANSIENT);
   /*txt and txt1 are the global objects i told about they have the values of Userid  and Passwd from the texxt fields respectively*/
sqlite3_bind_text(compiledStatement,2,[txt1 UTF8String],-1,SQLITE_TRANSIENT);


if(SQLITE_DONE != sqlite3_step(compiledStatement))
 txt3 =[[NSString alloc] initWithUTF8String:(char*)sqlite3_column_text(compiledStatement,0)];


else
    NSAssert1(0, @"Error while getting the username '%s'", sqlite3_errmsg(dB));         
    sqlite3_reset(compiledStatement);
Run Code Online (Sandbox Code Playgroud)

它在编译时没有错误,但是应用程序不起作用,它在查询中显示了一些错误(在运行时).如果您无法弄清楚给出的数据,我将为您提供整个代码.

我在这里添加了错误详细信息:
如果我在select查询中使用","(逗号),则会出现此错误:

***由于未捕获的异常
'NSInternalInconsistencyException' …

sqlite iphone

3
推荐指数
1
解决办法
1548
查看次数

iCarousel - 更改中心项目动态iOS

我在我的iPad应用程序中使用iCarousel,我想知道是否有办法在选择时动态更改中心项目的视图.总之,我想实现这样的目标在此输入图像描述 我设法将第一个索引(项目 - 0)设置为红色,但我无法找到一种方法来执行以下操作:

当选择1时,我希望将0的图像更改为纯白色,将1的图像更改为红色.

也是2件事.

任何帮助或建议将不胜感激.

谢谢

ipad ios icarousel

3
推荐指数
1
解决办法
3589
查看次数

使用 CGAffineTransform 旋转后 UIView 调整大小视图大小是不可预测的

可能的重复:
iPhone 中旋转后 UIView 框架的奇怪行为

我正在开发一个应用程序,它具有旋转视图和调整视图大小的功能。我已经实现了这个功能,但我确实面临一个问题。

我的问题

拖动视图的四个角时,视图将被调整大小,调整大小后,我可以在两个方向上旋转视图。

旋转完成后,如果我再次尝试通过拖动视图的角来调整视图的大小,则视图的大小会变成不可预测的值,并且会在屏幕上移动。

类似问题

我用谷歌搜索了很多,但没有得到任何完美的答案。有些人问了同样的问题,但没有人得到任何好的结果。我花了很多时间,但无法解决它。请帮助我以下是类似问题的列表:

类似问题链接:1

类似问题链接:2

我的示例代码

关联

调整视图大小的代码

触摸开始方法

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

UITouch *touch = [[event allTouches] anyObject];

NSLog(@"[touch view]:::%@",[touch view]);

touchStart = [[touches anyObject] locationInView:testVw];
isResizingLR = (testVw.bounds.size.width - touchStart.x < kResizeThumbSize && testVw.bounds.size.height - touchStart.y < kResizeThumbSize);
isResizingUL = (touchStart.x <kResizeThumbSize && touchStart.y <kResizeThumbSize);
isResizingUR = (testVw.bounds.size.width-touchStart.x < kResizeThumbSize && touchStart.y<kResizeThumbSize);
isResizingLL = (touchStart.x <kResizeThumbSize && testVw.bounds.size.height -touchStart.y <kResizeThumbSize);    
}
Run Code Online (Sandbox Code Playgroud)

触摸移动方法

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
CGPoint touchPoint …
Run Code Online (Sandbox Code Playgroud)

rotatetransform uiview cgaffinetransform ios

2
推荐指数
1
解决办法
3530
查看次数