OC代码: - (void)layoutSaleViews{ [self startTime]; if (self.isEarlyBird == YES) { _homeDetailView.saleTodayImg.width = 0; _homeDetailView.moneyIcon.left = 12; _homeDetailView.tipImageView.hidden = NO; }else{ _homeDetailView.tipImageView.hidden = YES; _homeDetailView.saleTodayImg.hidden = NO; } [_homeDetailView.messageView mas_updateConstraints:^(MASConstraintMaker *make) { make.height.equalTo(@94.5); }]; _homeDetailView.dayAllMoney.hidden = YES; _homeDetailView.moneyIcon1.hidden = YES; _homeDetailView.rentDay.hidden = YES; _homeDetailView.weekOrMonthView.hidden = YES; [_homeDetailView.weekOrMonthView mas_updateConstraints:^(MASConstraintMaker *make) { make.height.equalTo(@0); }]; _homeDetailView.collectBtn.hidden = YES; _homeDetailView.line.hidden = YES; _homeDetailView.rentDateLbl.text = [NSString stringWithFormat:@"%@-%@",[[_saleModel.act_begin_date substringWithRange:NSMakeRange(0, 10)] stringByReplacingOccurrencesOfString:@"-" withString:@"."],[[_saleModel.act_end_date substringWithRange:NSMakeRange(0, 10)] stringByReplacingOccurrencesOfString:@"-" withString:@"."]]; if ([NSString isBlankString:_saleModel.masterNeedKnow]) { [_homeDetailView.rentExplainView mas_updateConstraints:^(MASConstraintMaker *make) { make.height.equalTo(@0); }]; _homeDetailView.rentExplainView.hidden = YES; [_homeDetailView.calendarView mas_updateConstraints:^(MASConstraintMaker *make) { make.top.equalTo(_homeDetailView.messageView.mas_bottom).offset(10); }]; }else{ _homeDetailView.rentExplainLbl.text = _saleModel.masterNeedKnow; } }
JS代码:
require('NSString'); defineClass('NewHomeDetailController', { layoutSaleViews: function() { self.startTime(); var _homeDetailView = self.valueForKey("_homeDetailView"); var _saleModel = self.valueForKey("_saleModel"); if (self.isEarlyBird() == YES) { _homeDetailView.saleTodayImg().setWidth(0); _homeDetailView.moneyIcon().setLeft(12); _homeDetailView.tipImageView().setHidden(NO); } else { _homeDetailView.tipImageView().setHidden(YES); _homeDetailView.saleTodayImg().setHidden(NO); } _homeDetailView.messageView().mas__updateConstraints(block('MASConstraintMaker*', function(make) { make.height().equalTo()(94.5); })); _homeDetailView.dayAllMoney().setHidden(YES); _homeDetailView.moneyIcon1().setHidden(YES); _homeDetailView.rentDay().setHidden(YES); _homeDetailView.weekOrMonthView().setHidden(YES); _homeDetailView.weekOrMonthView().mas__updateConstraints(block('MASConstraintMaker*', function(make) { make.height().equalTo()(0); })); _homeDetailView.collectBtn().setHidden(YES); _homeDetailView.line().setHidden(YES); _homeDetailView.rentDateLbl().setText(NSString.stringWithFormat("%@-%@", _saleModel.act__begin__date().substringWithRange({location: 0, length: 10}).stringByReplacingOccurrencesOfString_withString("-", "."), _saleModel.act__end__date().substringWithRange({location: 0, length: 10}).stringByReplacingOccurrencesOfString_withString("-", "."))); if (NSString.isBlankString(_saleModel.masterNeedKnow())) { _homeDetailView.rentExplainView().mas__updateConstraints(block('MASConstraintMaker*', function(make) { make.height().equalTo()(0); })); _homeDetailView.rentExplainView().setHidden(YES); _homeDetailView.calendarView().mas__updateConstraints(block('MASConstraintMaker*', function(make) { make.top().equalTo()(_homeDetailView.messageView().mas__bottom()).offset()(10); })); } else { _homeDetailView.rentExplainLbl().setText(_saleModel.masterNeedKnow()); } }, });
总结:
1.Masonry中遇到单下划线要改成双下划线 ,数值@2,要改成2
2.变量名中遇到单下划线要改成双下划线
如:_saleModel.act__end__date()