【问题标题】:how to implemet database logic in tableview to controll rows information?如何在表视图中实现数据库逻辑来控制行信息?
【发布时间】:2011-08-08 10:26:54
【问题描述】:

我的意思是我想实现我将从数据库中获取数据的表。我将所有数据存储到数据库中,现在问题是我无法在 tableView 中显示这些数据,如下所述。你也可以看看我想开发像 chipottle Chipottle app 这样的表格的例子。有一个用于创建订单列表信息的袋子。如果您没有收到我的问题,请查看 Chipottle 应用程序只是创建订单,它将存储在主视图中的袋子中单击袋子按钮,您将看到一个包含您创建的所有订单信息的表格和在最后一个字幕中。请查看完全免费的应用程序我真的陷入了这个问题,所以请尝试帮助我。

我在数据库中存储了 10 个字段 订单名称 ={Order1,Order2}
类别 = {category1,category2}
submenu1 = {{sub00,sub01,sub02},{sub11,sub12}}
价格1 = {{$2,$3.1,$4.2},{$7.85,$2.3}}
submenu2 = {{sub21,sub22,sub23,sub24},{sub31,sub32}}
价格2 = {{$2.2,$4.5,$7.7,$3.2},{$4.4,$1.3}}
Drinkmenu = {百事可乐、百事可乐1、苏打水、柠檬、菠萝汽水}
dirnkprice = {$4.4,$8.5,$3.7,$2.8,$3.4}

我数了数。 of section like = [Ordername count] 。也可以根据 Ordername 显示部分标题。

现在我想在 Zero(0) 索引处显示类别、子菜单 1、价格 1、子菜单 2、价格 2,这意味着(在 indexpath.row = 0 处)根据 Ordername 的所有值。

对于drinkmenu,它显示在不同的 indexpath.row 上,但在零索引之后。

谢谢。 非常紧急。

【问题讨论】:

    标签: xcode ios4 iphone


    【解决方案1】:

    通过以下链接,您将完成您的工作。

    http://blog.webscale.co.in/?p=284

    是 UITableViewCell 的自定义。

    希望对你有帮助。

    【讨论】:

      【解决方案2】:

      您所要做的就是创建一个特殊的订单 tableViewCell 并放入您的数据,仅在 indexPath.row == 0 时显示它。下面是一些示例代码:

      - (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)anIndexPath
      {
          // sectioning logic here...
      
          if(anIndexPath.row == 0) {
              // Helper to create a fresh cell, implements dequeueing
              OrderTableViewCell *cell = [TableViewCellFactory orderTableViewCell:aTableView];
      
              // pass on the cell to do fill in data
              [self configureOrderCellWithCell:cell andIndexPath:anIndexPath];
      
              return cell;
          } else {
              // process other cells
          }
      }
      
      - (void)configureVideoClipCellWithCell:(VideoClipTableViewCell *)aCell andIndexPath:(NSIndexPath *)anIndexPath
      {
          // get model at current indexPath
          Order *order = [orders objectAtIndex:anIndexPath.row];
      
          // publish data in cell
          aCell.category.text = order.category;
          aCell.submenu1.text = order.submenu1;
          aCell.price1.text = order.seprice1rie;
          aCell.submenu2.text = order.submenu2;
          aCell.price2.text = order.price2;   
      }
      

      【讨论】:

        猜你喜欢
        • 2011-03-12
        • 2011-06-09
        • 1970-01-01
        • 2011-08-24
        • 1970-01-01
        • 2014-12-26
        • 2014-03-18
        • 2012-10-19
        • 1970-01-01
        相关资源
        最近更新 更多