我想在按下特定按钮时交换2 Autolayout
的位置。这是我的代码。它们都受 CGRect tempFrame=_flightButton.frame;
UIViewAutoresizing tempResize=_flightButton.autoresizingMask;
[_flightButton setFrame:_contactButton.frame];
[_flightButton setAutoresizingMask:_contactButton.autoresizingMask];
[_contactButton setFrame:tempFrame];
[_contactButton setAutoresizingMask:tempResize];
NSArray *tempConstraints=_flightButton.constraints;
[_flightButton removeConstraints:_flightButton.constraints];
[_flightButton addConstraints:_contactButton.constraints];
[_contactButton removeConstraints:_contactButton.constraints];
[_contactButton addConstraints:tempConstraints];
也试过这个。交换约束。这不起作用
{{1}}