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

  • 相关阅读:
    是否需要有代码规范
    小学四则运算生成程序(支持分数)总结
    HDU 4035 Maze 期望dp
    UVA
    HDU 3853 LOOPS 期望dp
    POJ 2096 Collecting Bugs 期望dp
    HDU 4405 Aeroplane chess 期望dp
    Codeforces Round #341 (Div. 2) E. Wet Shark and Blocks dp+矩阵加速
    HDU 4616 Game 树形dp
    HDU 4126 Genghis Khan the Conqueror 最小生成树+树形dp
  • 原文地址:https://www.cnblogs.com/fuhaots2009/p/3476374.html
Copyright © 2011-2022 走看看