gsdios / SDAutoLayout

One line of code to implement automatic layout. 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于做最简单易用的AutoLayout库。The most easy way for autoLayout. Based on runtime.
MIT License
5.9k stars 1.28k forks source link

我用Xib创建的cell,怎么修改cell里面内容的约束? #56

Closed wings0728 closed 8 years ago

wings0728 commented 8 years ago

我想动态修改他的高度,我是这么写的:

    _nameLabel.sd_layout.heightIs(_iconView.height);

结果崩溃了:

reason: '-[UILabel sd_layout]: unrecognized selector sent to instance 0x7fb4334f8880'

我现在尝试不用xib,但是也奔溃,完全不知道问题出在哪里

    UIImageView *iconView = [[UIImageView alloc] init];
    [self.contentView addSubview:iconView];
    _iconView = iconView;

    iconView.sd_layout
    .topSpaceToView(self.contentView, 5)
    .leftSpaceToView(self.contentView, 5)
    .bottomSpaceToView(self.contentView, 5)
    .widthEqualToHeight();

错误信息:-[UIImageView sd_layout]: unrecognized selector sent to instance 0x7fa7b5c7e9a0

gsdios commented 8 years ago

clear下工程再试试,加入 SDAutoLayout qq交流群(497140713)然后联系下我反馈下你的问题