jacky jacky - 1 year ago 66
iOS Question

How to display data from sqlite in UITableViewCell

I am noob in sqlite on iphone and I learned a few days. I searched on internet and this site and so confused about sqlite and to use of it.
I have one json url that has many value. I want to receive and parse one specific value and save in sqlite and read from sqlite in UITableView.

I parses json and save it in sqlite DB with specific Query but I dont know about retrieving data and displaying it.
please tell me this with code.
Sorry if my English not good.

Answer Source

Go through my answer here : -


Hope it will help you

for display array value use this code :

Now in the cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

     UITableViewCell *cell=[[UITableViewCell alloc]  initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
    //Add the Bg Image to the cell
     //Add the Label
     UILabel *cellTitle=[[UILabel alloc]initWithFrame:CGRectMake(15, 7, 300, 30)];
     [cellTitle setBackgroundColor:[UIColor clearColor]];
     [cellTitle setFont:[UIFont fontWithName:@"Helvetica-Bold" size:12]];
     [cellTitle setTextColor:[UIColor darkGrayColor]];
     [cellTitle setText:[[array objectAtIndexPath:indexPath.row] objectForKey:@"Name"]];
     [cell.contentView addSubview:cellTitle];
     return  cell;


also in the numberOfRowsInSection:

   -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section   
       return [array count];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download