Foundation and UIKit give us constructors for all kinds of structures
CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)
CGPointMake(<#CGFloat x#>, <#CGFloat y#>)
CGVectorMake(<#CGFloat dx#>, <#CGFloat dy#>)
NSMakeRange(<#NSUInteger loc#>, <#NSUInteger len#>)
Copy the code
I’ve used these functions for so long that I’ve forgotten that these things are structures, and that’s actually what they looked like in the first place
CGRect the rect = (CGRect),0,0,0 {0}; CGPoint point = (CGPoint) {0, 0}; NSRange range = (NSRange) {0, 1};Copy the code
However, I have heard an OC lecturer say that since you are already using OC, you should try to avoid using C things like NSInteger instead of int, CGFloat instead of float and double