博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
自定义xibUIView上控件从Model赋值问题
阅读量:7012 次
发布时间:2019-06-28

本文共 799 字,大约阅读时间需要 2 分钟。

  hot3.png

懒加载使用属性的声明方式,初始化方法以外需要使用self.调用

@property (nonatomic,strong)LDJDailyFreshnessView * freshnessView;-(LDJDailyFreshnessView *)freshnessView{    if (!_freshnessView) {                        _freshnessView = [[[NSBundle mainBundle]loadNibNamed:@"LDJDailyFreshnessView" owner:self options:nil]lastObject];        _freshnessView.frame = CGRectMake(0, -[DMDevceManager screenHeight], [DMDevceManager screenWidth], [DMDevceManager screenHeight]);        LDJDailyFreshnessModel * model = dailyInfoArray[0];        _freshnessView.model = model;            }      return _freshnessView;}

传值给xib UIView的.m model时:重写setter方法,写在初始化方法里不行.

-(void)setModel:(LDJDailyFreshnessModel *)model{    _model = model;      self.photoSchoolLabel.text = self.model.photo_kdg_name;}

 

转载于:https://my.oschina.net/bjwkk/blog/779086

你可能感兴趣的文章
CentOS 6.8 防火墙配置
查看>>
Spring Boot 2.0 整合 FreeMarker 模板引擎
查看>>
Java 知识点
查看>>
Nginx+Tomcat高性能负载均衡集群搭建
查看>>
BZOJ3573: [Hnoi2014]米特运输(树上乱搞)
查看>>
Dubbo的一些编码约定和设计原则
查看>>
IDA 操作记录
查看>>
告警系统需求分析 告警系统主脚本 告警系统配置文件 告警系统监控项目
查看>>
JavaServer Faces (JSF) with Spring
查看>>
知物由学 | 这些企业大佬如何看待2018年的安全形势?
查看>>
[转]Mongodb的下载和安装
查看>>
usb_submit_urb
查看>>
[Node.js] Add Logging to a Node.js Application using Winston
查看>>
qt-solutions提供了8个开源项目
查看>>
处理:“ORA-00257: archiver error. Connect internal only, until freed”的错误问题
查看>>
java 取汉字首字母
查看>>
苹果版小黄车(ofo)app主页菜单效果
查看>>
使用Genymotion模拟器或者手机运行ionic4程序
查看>>
Hadoop之父Doug Cutting
查看>>
关于socket阻塞与非阻塞情况下的recv、send、read、write返回值---部分内容可能不确切,待讨论...
查看>>