为了账号安全,请及时绑定邮箱和手机立即绑定

iOS 使用Masonry库做动画时报错?

iOS 使用Masonry库做动画时报错?

牧羊人nacy 2019-05-24 19:01:21
1.实现过程:在VCviewDidload方法中self.viewaddSubView:aLabel,viewWillLayoutSubviews中使用Masonry添加label约束;另外界面有一个button,当当点击button时候做动画.-(void)viewDidLoad{[superviewDidLoad];[self.viewaddSubview:self.nameLabel];}-(UILabel*)nameLabel{if(!_nameLabel){_nameLabel=[[UILabelalloc]initWithFrame:CGRectZero];_nameLabel.lineBreakMode=NSLineBreakByTruncatingTail;_nameLabel.text=@"王二小";_nameLabel.backgroundColor=[UIColorgreenColor];_nameLabel.textAlignment=NSTextAlignmentLeft;}return_nameLabel;}-(void)viewWillLayoutSubviews{[selfaddCContraints];}-(void)addCContraints{[self.nameLabelmas_makeConstraints:^(MASConstraintMaker*make){make.left.equalTo(self.view.mas_left).offset(10);make.top.equalTo(self.view.mas_top).offset(10);}];}//点击button的响应时间.-(void)animationAction{///设置长度.[self.nameLabelmas_updateConstraints:^(MASConstraintMaker*make){make.left.mas_equalTo(-30);}];[UIViewanimateWithDuration:0.3animations:^{[self.nameLabel.superviewlayoutIfNeeded];}];}**"约束冲突信息:"**2017-08-0922:24:47.196344NSString[13501:3837010][LayoutConstraints]Unabletosimultaneouslysatisfyconstraints.Probablyatleastoneoftheconstraintsinthefollowinglistisoneyoudon'twant.Trythis:(1)lookateachconstraintandtrytofigureoutwhichyoudon'texpect;(2)findthecodethataddedtheunwantedconstraintorconstraintsandfixit.("","")WillattempttorecoverbybreakingconstraintMakeasymbolicbreakpointatUIViewAlertForUnsatisfiableConstraintstocatchthisinthedebugger.ThemethodsintheUIConstraintBasedLayoutDebuggingcategoryonUIViewlistedinmayalsobehelpful.跟了下Masonry执行过程也没发现什么问题.有朋友遇到过这种问题么?感谢在先.
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 495 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信