开发者

changing a picker to table view OR having multiple table views on the same view

My iPad app was rejected due to my use of a picker. The picker was used to control a table view. In my view, a picker was displaying a series of items and when开发者_如何学C one of those items was selected, it used that selection to populate a table with data. (hopefully that makes sense). Now I need to do this without the picker so I need to have the data that was in the picker be represented in a table view.

My question, is how do I have multiple tableViews in the same view?

is it as simple as having separate delegate methods for each tableview like this?

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView1
{

    return [xxx count];

}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView2
{

    return [yyy count];

}


The names of the delegate methods are fixed. So you can either

  1. Use two different delegate instances, or
  2. Identify the table within the method, e.g.

    -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        if (tableView.tag == 114)
          return [xxx count];
        else
          return [yyy count];
    }
    
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜