zoukankan      html  css  js  c++  java
  • IOS 表视图UITableView 束NSBundle



    今天搞了一下表视图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

  • 相关阅读:
    树莓派测试摄像头
    React Native入坑记录
    2016总结及2017计划
    C#操作Excel
    IntelliJ配置SpringMVC提示“found:java.lang.String required:java.lang.String”
    opencv手工编译
    iOS webview注入JS
    C#生成exe、dll版本号自动增加
    iOS 允许po打印frame等内容
    2015总结及2016计划
  • 原文地址:https://www.cnblogs.com/fuhaots2009/p/3476374.html
Copyright © 2011-2022 走看看