Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
现在我的视图上有两个 UIButton。我想知道如何交换它们。我已经弄清楚如何使用滑动手势。只需要帮助用动画交换他们的位置。谢谢
假设您没有使用自动布局,您可以使用
[UIView animateWithDuration:0.25 animations:^{ CGRect savedFrame = self.button1.frame; self.button1.frame = self.button2.frame; self.button2.frame = savedFrame; }];