gpt4 book ai didi

ios - 移动 iOS 后单击时按钮消失

转载 作者:行者123 更新时间:2023-11-28 21:31:10 25 4
gpt4 key购买 nike

当我将我的按钮旋转到横向时,移动正确,但当我点击时,它们都消失了。有谁知道为什么?

UIButton *recordingButton = (UIButton *)[self.view viewWithTag:1];
CGRect frame1 = [recordingButton frame];
frame1.origin.x += 255;
frame1.origin.y -= 250;// change the location
[recordingButton setFrame:frame1];

UIButton *streamingButton = (UIButton *)[self.view viewWithTag:2];
CGRect frame2 = [streamingButton frame];
frame2.origin.x += 255;
frame2.origin.y -= 250;// change the location
[streamingButton setFrame:frame2];

UIButton *uploadButton = (UIButton *)[self.view viewWithTag:3];
CGRect frame3 = [uploadButton frame];
frame3.origin.x += 255;
frame3.origin.y -= 250;// change the location
[uploadButton setFrame:frame3];

最佳答案

这是因为您在 Storyboard中使用了自动布局。您不能更改使用自动布局约束定位的 View 的 frame;它是定位它的约束。使用约束(最好是 Storyboard中的约束)在代码中执行您在此处执行的操作。

关于ios - 移动 iOS 后单击时按钮消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36048370/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com