这个是手机里的设置页面,这种是用UITableView实现的。
UITableView有两种风格:UITableViewStylePlain和UITableViewStyleGrouped。上面的风格属于UITableViewStyleGrouped。
UITableView中数据只有行的概念,没有列的概念。UITableView中每一行数据都是一个UITableViewCell。
数据源
对于UITableView设置完dataSource后需要实现UITableViewDataSource协议,这个协议中定义了多种数据操作。其中下面两个是必须实现的方法。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
代理
某个cell被选中后,调用下面的方法。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath;