Reputation: 3
Typically when creating a frame for a view I use CGRect where the parameters accepts CGFloat, Double or Int. They all create a rectangle with coordinates and dimensions specified as a CGFloat, Int or Double (summarized from Apple Doc), but does it matter which type of value you choose to use? Is there some underlying difference in choosing one option over the other. Is it the way they use memory differently?
Upvotes: 0
Views: 66
Reputation: 2262
There shouldn't be any difference.
Those are convenience initializers. That means you can have inits with different parameters/parameter types.
But, of course, if you want to create a CGRect
with edges that are not Int
(if you want real numbers), than you will need to use the init
with Double
or CGFloat
parameters (even though the syntax will look pretty much the same, behind the scenes, the initializer for that specific type will be called).
Upvotes: 0