美文网首页
ios plist 解析数据

ios plist 解析数据

作者: 你又脸红了i | 来源:发表于2018-11-17 08:45 被阅读0次

1. 新建plist 文件

2.MVC model.h 定义属性 调用

3.新建 .m  @property(nonatomic,strong) NSMutableArray * dataarr; //定义数组属性

_dataarr = [NSMutableArray new];

    NSString *file = [[NSBundle mainBundle]pathForResource:@"music.plist" ofType:nil];

    NSDictionary *dic = [NSDictionary dictionaryWithContentsOfFile:file];

    for(NSDictionary*dic1indic[@"Cell"]) {

        SongModel* model = [SongModelnew];

        [modelsetValuesForKeysWithDictionary:dic1];

        [self.dataarraddObject:model];

    }

    [self.table reloadData];

赋值到cell里

cell.imageView.image =[UIImage imageNamed:[self.dataarr[indexPath.row]image]];

    cell.textLabel.text= [self.dataarr[indexPath.row]textT1];

    cell.detailTextLabel.text= [self.dataarr[indexPath.row]textT2];

    cell.textLabel.numberOfLines = 0;

    cell.accessoryType = 1;

高度

-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath{

    return 70;

}

-(CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section{

    return 200;

}

-(UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section{

  viewHeader = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];

    //viewHeader.backgroundColor = [UIColor orangeColor];

 return viewHeader;

}

相关文章

  • ios plist 解析数据

    1. 新建plist 文件 2.MVC model.h 定义属性 调用 3.新建 .m @property(non...

  • iOS数据存储

    iOS应用数据存储方式(XML属性列表-plist) 一、ios应用常用的数据存储方式 1.plist(XML属性...

  • 数据存储

    iOS应用数据存储的常用方式 1. Plist存储(属性列表) Plist存储(Documents) Plist提...

  • UI-plist、懒加载、封装、模型

    1、加载plist文件 文件名不为 info.plist 接下来通过代码来解析Plist文件中的数据获得Plist...

  • iOS runtime进行数据解析封装

    iOS runtime进行数据解析封装 iOS runtime进行数据解析封装

  • iOS开发-数据持久化之plist文件

    摘要 通过对plist文件的操作对iOS开发中一些数据进行持久化保存。 iOS数据持久化之一——plist文件 i...

  • iOS数据存储--数据库

    iOS中数据存储方式 iOS中数据存储方式主要有以下几种 Plist NSUserDefaults NSCodin...

  • iOS数据持久化

    iOS数据持久化 iOS应用数据存储的常用方式 XML属性列表(plist)归档 Preference(偏好设置)...

  • plist 文件写入与读取

    plist是iOS中特有的一种文件形式,将数据写入plist文件的实质就是生成plist文件,那什么样的数据才能生...

  • iOS App的启动过程

    1.iOS系统首先会加载解析该app的info.plist文件,因为info.plist中包含了支持app加载进行...

网友评论

      本文标题:ios plist 解析数据

      本文链接:https://www.haomeiwen.com/subject/tgkbfqtx.html