I used the storyboard for the project.The problem is it cannot push to the Function1DetailViewController.Moreover, since the tableview do not have the cell inside,I don't know how to draw the segue to link between the two view controllers. Also, I don't know how to write the prepareForSegue method.
Should I also need to make some changes in didSelectRowAtIndexPath method?
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *tempSqlStatement = @"";
NSString *tempString = @"%";
databaseName = @"TCMdb8.sql";
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
databasePath = [documentsDir stringByAppendingPathComponent:databaseName];
if (buttonNum == 0) {
Function1DetailViewController *function1DetailViewController = [[Function1DetailViewController alloc] initWithKey:[listOfItems objectAtIndex:indexPath.row] type:@"1"];
[self.navigationController pushViewController:function1DetailViewController animated:YES];
} else if (buttonNum != 0){
if (buttonNum == 1) {
tempSqlStatement = [NSString stringWithFormat:@"select name from Medicine where stroke ='%@' ORDER BY length(name) ASC", [listOfItems objectAtIndex:indexPath.row]];
}
function1SQLStatement = [tempSqlStatement UTF8String];
[self checkAndCreateDatabase];
[self readFromDatabase];
[tableList reloadData];
buttonNum = 0;
}
}