iOS JSPatch热更新之实战演练
来源:互联网 发布:sql like 多个条件 编辑:程序博客网 时间:2024/05/07 21:45
哈哈哈,希望上线的代码永无bug,这样就不用热更新了。。。
//导入需要的头文件
require('UILabel,UIImageView,NSURL,NSString,UZGPersonalSetting,UIImage,UIFont,UIScreen')
require('UIColor')
defineClass("VersionUpdateController",{
tapBackGroundView:function(tapGeture){
//获取私有变量
var update_type = self.valueForKey("update_type");
if(update_type.isEqualToString("1")){
self.removeSelf();
}
}
})
defineClass("HourCell",['connectionImg','giftImg','giftLabel','giftNumLabel'],{
reloadCell:function (model) {
var s= UZGPersonalSetting.getInstance();
var string=NSString.stringWithFormat("%@%@",s.image__host(),model.image());
var str=NSURL.URLWithString(string);
self.productImage().sd__setImageWithURL(str);
self.titleL().setText(model.title());
var cellFloat=model.price().floatValue()/model.num2().floatValue();
var stringStr=NSString.stringWithFormat("%@¥.2f",model.price__type(),cellFloat.toFixed(2));
if (model.price__type().length()==0){
stringStr=NSString.stringWithFormat("¥%@",cellFloat.toFixed(2));
}
self.priceL().setText(stringStr);
self.numL().setText(NSString.stringWithFormat("x %@", model.num2()));
//动态新增property
self.setConnectionImg();
self.setGiftImg();
self.setGiftLabel();
self.setGiftNumLabel();
if (model.numyy().isEqualToString("0") ||model.numyy().length ==0) {
self.connectionImg().removeFromSuperview();
self.giftImg().removeFromSuperview();
self.giftLabel().removeFromSuperview();
self.giftNumLabel().removeFromSuperview();
} else {
self.setConnectionImg(UIImageView.alloc().initWithFrame({x:25,y:88,width:17,height:17}));
self.connectionImg().setImage(UIImage.imageNamed("关联ico"));
self.contentView().addSubview(self.connectionImg());
self.setGiftImg(UIImageView.alloc().initWithFrame({x:45,y:96,width:15,height:15}));
self.giftImg().setImage(UIImage.imageNamed("赠ico"));
self.contentView().addSubview(self.giftImg());
self.setGiftLabel(UILabel.alloc().initWithFrame({x:67,y:90,width:UIScreen.mainScreen().bounds().width-127,height:25}));
self.giftLabel().setFont(UIFont.systemFontOfSize(12));
self.giftLabel().setTextColor(UIColor.colorFromHexCode("#666666"));
self.giftLabel().setText(model.title());
self.contentView().addSubview(self.giftLabel());
self.setGiftNumLabel(UILabel.alloc().initWithFrame({x: UIScreen.mainScreen().bounds().width-52,y:90,width:40,height:25}));
self.giftNumLabel().setFont(UIFont.systemFontOfSize(12));
self.giftNumLabel().setTextAlignment(2);
self.giftNumLabel().setTextColor(UIColor.colorFromHexCode("#666666"));
self.giftNumLabel().setText(NSString.stringWithFormat("x %@",model.numyy()));
self.contentView().addSubview(self.giftNumLabel());
}
}
});
这里要注意的是:
1:宏变量的使用:(UIColor.colorFromHexCode("#666666")
2:导入category的注意 :require('UIColor'),只需要导入原来的类就可以了
3:动态创建property ['connectionImg','giftImg','giftLabel','giftNumLabel']
self.setConnectionImg();
self.setGiftImg();
self.setGiftLabel();
self.setGiftNumLabel();
- iOS JSPatch热更新之实战演练
- iOS- JSPatch 热更新
- iOS热更新,JSPatch初探
- iOS热更新技术---------------- JSPatch
- iOS之热修复JSPatch 补丁更新管理
- IOS热修复之JSPatch
- IOS热修复之JSPatch
- ios JSPatch热更新技术详解
- 热修复JSPatch之实战教程
- IOS热修复之 JSPatch 实现方案
- 热更新JSPatch学习:
- iOS热修复JSPatch
- iOS热修复 JSPatch
- iOS热修复(JSPatch)
- iOS通过 JSPatch实现 app的热更新
- iOS热更新-JSPatch实现原理+Patch现场恢复
- iOS热更新-JSPatch实现原理+Patch现场恢复
- IOS热更新-JSPatch实现原理+Patch现场恢复
- 如何在Linux(CentOS 7)命令行模式安装VMware Tools
- java基础学习总结——异常处理
- nested exception is java.sql.SQLException: 内部错误
- gerrit 各种问题
- 头发的功用
- iOS JSPatch热更新之实战演练
- 编程小白---数据库从零学起(1)
- MSP4301602显示Ⅱ
- ORACLE创建表空间
- Awk命令简单使用
- ssh无密码登录配置
- 学习运维第四周——第十、十一、十二单元作业
- 自动排队的异步Ajax请求
- 工厂模式