IOS 表视图UITableView 束NSBundle

2022-12-05,,,

今天搞了一下表视图UITableView
表视图是在以后应用程序开发中经常用到的一个视图,所以必须要熟练掌握
所获不多,对视图有了一个大概的了解
其中有用到NSBundle , 束   这个类
先说一下这个类,这个类大概看了一下,NSBundle说到底还是一个路径而已
[NSBundle mainBundle]用这个方法可以:
返回当前应用程序可执行文件的一个目录
    NSString *path = [[NSBundle mainBundle] pathForResource:@"sortednames" ofType:@"plist"];
然后再用这个方法就可以以文件名和文件类型获取文件路径,通过这个路径就可以访问这个文件了

表视图中常用的几个方法

1、
//设置表的分组数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
2、
//设置每个分组的行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
3、
//为每个分区指定一个标题
- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
4、

//为每行导入数据
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
5、
//创建索引
- (NSArray*)sectionIndexTitlesForTableView:(UITableView *)tableView

先就写这么多吧,明天继续更新 ——LC

IOS 表视图UITableView 束NSBundle的相关教程结束。

《IOS 表视图UITableView 束NSBundle.doc》

下载本文的Word格式文档,以方便收藏与打印。