UITableView, how do I know what Section during cellForRowAtIndexPath?

前端 未结 3 1307
隐瞒了意图╮
隐瞒了意图╮ 2021-02-03 16:39

I have a UITableView displaying a list of Cities. I want to separate them by State. I can\'t seem to figure out how to get it to pick the right items out of my Array. If Sectio

3条回答
  •  爱一瞬间的悲伤
    2021-02-03 17:39

    The method is called

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

    The indexpath parameter contains a row and section property.

    indexPath.section  
    indexPath.row
    

    Here's documentation link for the NSIndexPath class.

提交回复
热议问题