Reputation: 24770
I use integers all the time in these two commands. It works fine and I suspect it's common to do this.
But technically, I believe they require CG Floats, not integers.
Why does it work, and it is wrong to do this? If so, how to easily convert an int
into a cg float
?
Upvotes: 1
Views: 3785
Reputation: 523344
Yes an int
can be implicitly converted to a float
(i.e. CGFloat
). Which means that, if you call CGSizeMake(40, 50)
, the C compiler can recognize that a float
is required and convert the generated code to CGSizeMake(40.0f, 50.0f)
automatically.
Upvotes: 7