开发者

Read two tables from database in sqlite in one grouped table view

I have an equations list in my app and I want to have a grouped table view load one table from my sqlite database into the first section of the table view and load another table from sqlite into the second section of the table view. Ok so I know how to create and 开发者_高级运维read the database from the app delegate and get my sqlite tables into two arrays that hold their content. I also know how to load one table from sqlite into a table view in xcode, but I still have a few questions. How do I set certain rows in my database to sections of my table view? Is it possible to load multiple tables from databse into one grouped table view?


I am also new to iphone development, but upto my knowledge you can not have multiple tables in one grouped table view.

You can use if conditions or switch cases for your application to decide sections and rows.

as I m giving an example of if condition where request type is an integer.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 

{ // Return the number of sections.

if(RequestType == 2) 
{
    return [arrayCityNames count];
}else
{
    return 1;
}
return 1;

}

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section.

    if(RequestType == 1) { return 1; }

    if(RequestType == 2) { return 2; } if(RequestType == 3) { return 1;

    } else { // Return the number of rows in the section. return 1; }

    return 0; }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜