Given that drawRect takes a CGRect ‘rect’, how can I create 4 separate CGFloat variables with the individual values of rect (x,y,width,height)? I need to use the variables on an individual basis to determine certain drawing scales within the drawRect method.
- (void)drawRect:(CGRect)rect {
CGFLoat x = ***x value of rect***;
CGFLoat y = ***y value of rect***;
CGFloat width = ***width value of rect***;
CGFloat height = ***height value of rect***;
}
Thanks in advance for your help!
I’d suggest you brush up on some basic C materials as the question is pretty basic C structure stuff (no big deal — we were all there once).
Given:
You want:
– (void)drawRect:(CGRect)rect {
CGFLoat x = rect.origin.x;
CGFLoat y = rect.origin.y;
CGFloat width = rect.size.width;
CGFloat height = rect.size.height;
}
Or, better yet, because there are functions for such madness: