What is the difference between bounds.size.width
and bounds.width
in swift? Will they return the same thing?
Thanks!
bounds
is a CGRect
struct property for a UIView that contains 2 nested structs within it; CGPoint
and CGSize
. These represent the points of origin for the view (x and y), and the size of the view in height and width specified in points respectively.
If you have a UIView that's 100 x 100, then: bounds.width
will return 100, and bounds.size.width
will also return 100. Basically they will return the same CGFloat
values even if your CGRect
has negative width and height values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With