YIem`s Blog -心比天高命比纸薄-链接找不到的请在站内搜索内容!

UI10_UITableView2

//
// RootViewController.m
// UI10_UITableView2
//
// Created by Marry W. on 12/18/15.
// Copyright (c) 2015 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

import "RootViewController.h"

import "NSString+Characters.h"

@interface RootViewController () <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, retain) NSMutableArray *arr;// 保存key
@property (nonatomic, retain) NSMutableDictionary *contactDic;// 保存所有联系人
@property (nonatomic, retain) UITableView *tableView;

@end

@implementation RootViewController

// 分区数

// 分区名

// 每个分区的行数

// cell.detailTextLabel.text = [[_arr objectAtIndex:indexPath.row] objectForKey:@"phone"];


// 获取key
NSString *key = _arr[indexPath.section];
// 获取key对应的数组
NSArray *arr = _contactDic[key];
// 获取每一个联系人
NSDictionary *dic = arr[indexPath.row];
// 设置
cell.textLabel.text = dic[@"name"];
cell.detailTextLabel.text = dic[@"phone"];

return cell;

}
// 右侧索引

/*

pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation

*/

@end

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »