Reputation: 3
When I move my buttons upon rotation to landscape, the move properly but when I click, they all disappear. Does anyone know why?
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];
Upvotes: 0
Views: 56
Reputation: 535586
It's because you're using auto layout in your storyboard. You can't go changing the frame
of a view positioned using auto layout constraints; it is the constraints that position it. Use constraints (preferably the constraints in the storyboard) to do what you are doing here in code.
Upvotes: 2