Reputation: 7854
Is it possible to make the default CGPoint
size for an iOS app "bigger"?
For example, the iPhone's main view is 320 points wide - is it possible to change that to, say, 100 points, and base all calculations on that 100 (as in still be able to use CGRectMake
, get sizes etc. normally).
So does anyone know how to subclass UIView
in such a way as to make the above work, and, more importantly, would Apple allow it?
Thanks for your time!
Upvotes: 0
Views: 124
Reputation: 32681
Apply a CGAffineTransformMakeScale(320/100, 320/100)
transform to your view so that it is scaled, and 100 points will be scaled to 100 * (320/100) = 320
points wide.
Or course, don't use magic numbers like above, but use some constant for the value 100
and something like [UIScreen mainScreen].applicationFrame.size.width
(or view.window.screen.applicationFrame.size.width
or anything similar) to get the width of the screen instead of the value 320
(because magic numbers are bad, and we never know if the size of the screen will change in any future like the height just changed with iPhone5)
Upvotes: 1
Reputation: 7486
Have a look at UIView
s transform
property. But this is probably a bad idea: If you rescale your coordinate system, almost all your views are going to be misaligned with the screen's pixels. This will lead to blurry display of text, lines and other graphics.
Why would you want to do this in the first place?
Upvotes: 0