我有 UIActionSheet。它显示数组中的标题。当我单击按钮时,什么都不会发生。我也使用了 NSLog。但它没有显示任何东西。按钮标题从数组中显示。但只有点击不起作用
代码:
行动单:
TSActionSheet *actionSheet = [[TSActionSheet alloc] initWithTitle:@"Design"];
for (int i = 0; i<[catearray count]; i++ ) {
[actionSheet addButtonWithTitle:[catearray objectAtIndex:i] block:^{
}];
}
按钮点击:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSLog(@"button");
} else if (buttonIndex == 1) {
NSLog(@"button 1");
} else if (buttonIndex == 2) {
NSLog(@"button 2");
} else if (buttonIndex == 3) {
}
}
大批:
if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
const char *sql = "SELECT id,cat_name FROM categories";
NSLog(@"sql is %s",sql);
sqlite3_stmt *statement;
// int catID = 0;
if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {
// We "step" through the results - once for each row.
while (sqlite3_step(statement) == SQLITE_ROW) {
category = [[NSString alloc] initWithUTF8String:
(const char *) sqlite3_column_text(statement, 1)];
NSLog(@"catName is %@",category);
[catearray addObject:category];
// catID = sqlite3_column_int(statement, 0);
}
}
sqlite3_finalize(statement);
}
else {
sqlite3_close(database);
NSAssert1(0, @"Failed to open database with message '%s'.", sqlite3_errmsg(database));
// Additional error handling, as appropriate...
}