当前位置: 首页 > news >正文

iOS 读取plist 方法

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

 - (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
   
    //读取自定义的 plist文件的写法
    
//    NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"customInfo" ofType:@"plist"];
//    NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
//    NSLog(@"dictionary = %@",dictionary);
    //将学生信息填入
//    NSDictionary *tmpInfo = [dictionary objectForKey:@"Student"];
//    self.txtStuName.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Name"]];
//    self.txtStuSex.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Sex"]];
//    self.txtStuNum.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Num"]];
    //将导师信息填入
//    tmpInfo = [dictionary objectForKey:@"Mentor"];
//    self.txtMtName.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Name"]];
//    self.txtMtSex.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Sex"]];

    
    //读取系统产生的 plist文件的写法
    
    NSDictionary *plistDic = [[NSBundle mainBundle] infoDictionary];
    NSLog(@"plistDic = %@",plistDic);
     
    //将学生信息填入
    NSDictionary *tmpInfo = [plistDic objectForKey:@"Student"];
    self.txtStuName.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Name"]];
    self.txtStuSex.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Sex"]];
    self.txtStuNum.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Num"]];
    //将导师信息填入
    tmpInfo = [plistDic objectForKey:@"Mentor"];
    self.txtMtName.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Name"]];
    self.txtMtSex.text = [NSString stringWithFormat:@"%@", [tmpInfo objectForKey:@"Sex"]];
    
}

 

转载于:https://my.oschina.net/iceTear/blog/706867

相关文章:

  • json恶补
  • mybatis实战教程(mybatis in action)之三:实现数据的增删改查
  • 在代码中修改TextView的DrawableRight图片
  • MongoDB-基础-limit-skip-sort
  • Python 安装模块 模块搜索路径
  • Android第三十天
  • nbsp
  • [改善Java代码]非稳定排序推荐使用List
  • Round 0: Regionals 2010 :: NEERC Eastern Subregional
  • 远程桌面卡
  • 二、ssh 协议:SSH 验证协议 —— 公钥认证
  • 安装程序时出现2502 2503错误解决方法
  • html5配合css3实现带提示文字的输入框(摆脱js)
  • AWS EC2 Run Command特性新增多重云脚本
  • 京东区域表整理
  • 【跃迁之路】【477天】刻意练习系列236(2018.05.28)
  • Codepen 每日精选(2018-3-25)
  • CSS居中完全指南——构建CSS居中决策树
  • ES学习笔记(10)--ES6中的函数和数组补漏
  • Java 网络编程(2):UDP 的使用
  • Java-详解HashMap
  • Linux各目录及每个目录的详细介绍
  • Python语法速览与机器学习开发环境搭建
  • Redis 懒删除(lazy free)简史
  • springMvc学习笔记(2)
  • Vim 折腾记
  • 初识 webpack
  • 初探 Vue 生命周期和钩子函数
  • 第13期 DApp 榜单 :来,吃我这波安利
  • 浮现式设计
  • 猴子数据域名防封接口降低小说被封的风险
  • 看域名解析域名安全对SEO的影响
  • 快速体验 Sentinel 集群限流功能,只需简单几步
  • 蓝海存储开关机注意事项总结
  • 前言-如何学习区块链
  • 微服务核心架构梳理
  • 消息队列系列二(IOT中消息队列的应用)
  • HanLP分词命名实体提取详解
  • Redis4.x新特性 -- 萌萌的MEMORY DOCTOR
  • # 数据结构
  • (8)Linux使用C语言读取proc/stat等cpu使用数据
  • (Matlab)使用竞争神经网络实现数据聚类
  • (poj1.2.1)1970(筛选法模拟)
  • (附源码)spring boot智能服药提醒app 毕业设计 102151
  • (更新)A股上市公司华证ESG评级得分稳健性校验ESG得分年均值中位数(2009-2023年.12)
  • (十七)Flask之大型项目目录结构示例【二扣蓝图】
  • ***php进行支付宝开发中return_url和notify_url的区别分析
  • .NET 5种线程安全集合
  • .net Application的目录
  • .Net Core 中间件验签
  • .NET 中什么样的类是可使用 await 异步等待的?
  • .NET中 MVC 工厂模式浅析
  • .考试倒计时43天!来提分啦!
  • @AutoConfigurationPackage的使用
  • @javax.ws.rs Webservice注解