Reputation: 8747
I´m setting up my view programmatically to show up when a button is pressed. My question is what's the difference between positioning a View programmatically with CGRect or with Constraints in storyboard/programmatic constraints?
I tried to set it programmatically and it works fine.
Upvotes: 1
Views: 99
Reputation: 54
CGRect will not fit all screen sizes as Constraints will. for example. CGRect x: 100, y: 500 may fit a large screen, but for an iPhone SE it will not work because the Item will be off screen. however with constraints like maybe Centre X & Y with a width and height constraint will centre something in the centre of the screen on all devices.
Upvotes: 1
Reputation: 11190
Simplified:
UIView
will have size and position depending on these valuesUpvotes: 2