Get dimensions of UIView Class for CGRects?

I am currently working on an app that draws a series of rectangles (CGRect) on a view and sizes them based on the size of the UIView. This code is contain in a class file that inherits UIView (rectangle.h/rectangle.m). I cannot for some reason use self.view.bounds.height or self.view.bounds.width to get the values I need. I am using the overridden method "drawrect" that is built into the class. How can I get the view size? or if thats not possible, how can I implement this?

Answers


Use

self.view.bounds.size.width 
self.view.bounds.size.height

or

if self class is itself a UIView

self.bounds.size.width 
self.bounds.size.height

Need Your Help

Saving a figure doesn't save its title position

matlab plot

I manually edit the position of the title of some plot as

retrieving POJO objects programmatically?

java sql oop reflection

Let, say for instance i have a POJO class employee with three attributes