NSLayoutConstraint *leftSpace =[NSLayoutConstraint
                                    constraintWithItem:_unloadBtn
                                    attribute:NSLayoutAttributeCenterY
                                    relatedBy:NSLayoutRelationEqual
                                    toItem:self
                                    attribute:NSLayoutAttributeCenterY
                                    multiplier:1
                                    constant:0];
    //    NSArray *selfConstraints=@[leftSpace];
    [self addConstraint:leftSpace];
虽然没有报错,但是不起作用。
几个问题
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
_unloadBtn 是否设置了
autolayout建议学习Masonry,附上一位大牛的文章,Masonry介绍与使用实践(快速上手Autolayout)